diff options
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/format-strings-fixit.c | 6 | ||||
-rw-r--r-- | clang/test/Sema/format-strings-i386.c | 15 | ||||
-rw-r--r-- | clang/test/Sema/format-strings.c | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/clang/test/Sema/format-strings-fixit.c b/clang/test/Sema/format-strings-fixit.c index c2fa2f77074..b4ab2306aa2 100644 --- a/clang/test/Sema/format-strings-fixit.c +++ b/clang/test/Sema/format-strings-fixit.c @@ -1,7 +1,7 @@ // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true -// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t -// RUN: %clang_cc1 -E -o - %t | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -pedantic -Wall -fixit %t || true +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -fsyntax-only -pedantic -Wall -Werror %t +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -E -o - %t | FileCheck %s /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the diff --git a/clang/test/Sema/format-strings-i386.c b/clang/test/Sema/format-strings-i386.c new file mode 100644 index 00000000000..45d10a763ac --- /dev/null +++ b/clang/test/Sema/format-strings-i386.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx10.7.0 -fsyntax-only -verify -Wformat-nonliteral %s + +int printf(const char *restrict, ...); + +// Test that 'long' is compatible with 'int' on 32-bit. +typedef unsigned int UInt32; +void test_rdar_9763999() { + UInt32 x = 7; + printf("x = %u\n", x); // no-warning +} + +void test_positive() { + printf("%d", "hello"); // expected-warning {{conversion specifies type 'int' but the argument has type 'char *'}} +} + diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index b47d3ca2616..d128d8ccc01 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/test/Sema/format-strings.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 -fsyntax-only -verify -Wformat-nonliteral %s #include <stdarg.h> typedef __typeof(sizeof(int)) size_t; |