diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2012-05-03 23:38:51 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2012-05-03 23:38:51 +0000 |
| commit | e31772fc44f41400e2106f31c9128657c30f0699 (patch) | |
| tree | 940ddcebd92f43a87ff9ac87992e4ffac280037d /clang | |
| parent | 45a5b5ebe93dd862b4edb9c967ee5fdcdac1bc25 (diff) | |
| download | bcm5719-llvm-e31772fc44f41400e2106f31c9128657c30f0699.tar.gz bcm5719-llvm-e31772fc44f41400e2106f31c9128657c30f0699.zip | |
Add a test for r156092.
llvm-svn: 156132
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/test/Sema/Inputs/format-unused-system-args.h | 8 | ||||
| -rw-r--r-- | clang/test/Sema/format-strings.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/clang/test/Sema/Inputs/format-unused-system-args.h b/clang/test/Sema/Inputs/format-unused-system-args.h new file mode 100644 index 00000000000..3a6b1654fbd --- /dev/null +++ b/clang/test/Sema/Inputs/format-unused-system-args.h @@ -0,0 +1,8 @@ +// "System header" for testing that -Wformat-extra-args does not apply to +// arguments specified in system headers. + +#define PRINT2(fmt, a1, a2) \ + printf((fmt), (a1), (a2)) + +#define PRINT1(fmt, a1) \ + PRINT2((fmt), (a1), 0) diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index 086c5c6d6fe..7e968899ac2 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 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs %s #include <stdarg.h> typedef __typeof(sizeof(int)) size_t; @@ -521,3 +521,10 @@ void test_other_formats() { dateformat(""); // expected-warning{{format string is empty}} dateformat(str); // no-warning (using strftime non literal is not unsafe) } + +// Do not warn about unused arguments coming from system headers. +// <rdar://problem/11317765> +#include <format-unused-system-args.h> +void test_unused_system_args(int x) { + PRINT1("%d\n", x); // no-warning{{extra argument is system header is OK}} +} |

