diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Lexer/wchar-signedness.c | 8 | ||||
-rw-r--r-- | test/Sema/format-strings.c | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/Lexer/wchar-signedness.c b/test/Lexer/wchar-signedness.c new file mode 100644 index 0000000000..fea0ecac64 --- /dev/null +++ b/test/Lexer/wchar-signedness.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=X86 +// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=ARM + +// CHECK-X86-NOT: #define __WCHAR_UNSIGNED__ +// CHECK-X86: #define __WINT_UNSIGNED__ 1 + +// CHECK-ARM: #define __WCHAR_UNSIGNED__ 1 +// CHECK-ARM-NOT: #define __WINT_UNSIGNED__ 1 diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index d1dca7e2fb..5d8e4cbb87 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -339,7 +339,12 @@ void pr7981(wint_t c, wchar_t c2) { 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 *'}} + // If wint_t and wchar_t are the same width and wint_t is signed where + // wchar_t is unsigned, an implicit conversion isn't possible. +#if defined(__WINT_UNSIGNED__) || !defined(__WCHAR_UNSIGNED__) || \ + __WINT_WIDTH__ > __WCHAR_WIDTH__ printf("%lc", c2); // no-warning +#endif } // <rdar://problem/8269537> -Wformat-security says NULL is not a string literal |