diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 36981b17ed939300f6f8fc2355a255f711fcef71 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /test/Sema/format-strings.c | |
parent | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff) |
Notes
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r-- | test/Sema/format-strings.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index b47d3ca2616cf..6b5f7e2c26623 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -87,7 +87,12 @@ void check_empty_format_string(char* buf, ...) va_list ap; va_start(ap,buf); vprintf("",ap); // expected-warning {{format string is empty}} - sprintf(buf,""); // expected-warning {{format string is empty}} + sprintf(buf, "", 1); // expected-warning {{format string is empty}} + + // Don't warn about empty format strings when there are no data arguments. + // This can arise from macro expansions and non-standard format string + // functions. + sprintf(buf, ""); // no-warning } void check_wide_string(char* b, ...) @@ -372,3 +377,13 @@ void check_char(unsigned char x, signed char y) { printf("%c", x); // no-warning printf("%hhu", y); // no-warning } + +// Test suppression of individual warnings. + +void test_suppress_invalid_specifier() { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-invalid-specifier" + printf("%@", 12); // no-warning +#pragma clang diagnostic pop +} + |