diff options
author | James Molloy <james.molloy@arm.com> | 2012-05-04 10:55:22 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2012-05-04 10:55:22 +0000 |
commit | 392da48160bd92ceb486792780467cbfdb2d0e8c (patch) | |
tree | 17b215252bcc1cfd72072422d0ebb1677fa94da3 /test/Sema/format-strings.c | |
parent | 2e4fd6d9a1c8ba9c400324d230cfc49050550dea (diff) |
Fix handling of wint_t - we can't assume wint_t is purely an integer promotion of wchar_t - they may differ in signedness.
Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.
There'll be a followup commit to fix that.
Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r-- | test/Sema/format-strings.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 7e968899ac..d1dca7e2fb 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs %s +#define __need_wint_t #include <stdarg.h> -typedef __typeof(sizeof(int)) size_t; +#include <stddef.h> // For wint_t and wchar_t + typedef struct _FILE FILE; int fprintf(FILE *, const char *restrict, ...); int printf(const char *restrict, ...); // expected-note{{passing argument to parameter here}} @@ -258,7 +260,6 @@ void f0(int_t x) { printf("%d\n", x); } // Unicode test cases. These are possibly specific to Mac OS X. If so, they should // eventually be moved into a separate test. -typedef __WCHAR_TYPE__ wchar_t; void test_unicode_conversions(wchar_t *s) { printf("%S", s); // no-warning @@ -332,16 +333,12 @@ void bug7377_bad_length_mod_usage() { } // PR 7981 - handle '%lc' (wint_t) -#ifndef wint_t -typedef int __darwin_wint_t; -typedef __darwin_wint_t wint_t; -#endif void pr7981(wint_t c, wchar_t c2) { printf("%lc", c); // no-warning printf("%lc", 1.0); // expected-warning{{the argument has type 'double'}} printf("%lc", (char) 1); // no-warning - printf("%lc", &c); // expected-warning{{the argument has type 'wint_t *' (aka 'int *')}} + printf("%lc", &c); // expected-warning{{the argument has type 'wint_t *'}} printf("%lc", c2); // no-warning } |