diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-07-14 06:49:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-07-14 06:49:52 +0000 |
commit | ba84cf53bc67bc622de0ae0599dd9166183b77c8 (patch) | |
tree | 245abd8b22cd2a77091c8b566ee0315d699007b3 /clang/test | |
parent | 0c666b46642d30ef063e5ead76525b81509fcfda (diff) | |
download | bcm5719-llvm-ba84cf53bc67bc622de0ae0599dd9166183b77c8.tar.gz bcm5719-llvm-ba84cf53bc67bc622de0ae0599dd9166183b77c8.zip |
Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.
llvm-svn: 135134
Diffstat (limited to 'clang/test')
-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; |