aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-09-29 05:52:16 +0000
committerTed Kremenek <kremenek@apple.com>2011-09-29 05:52:16 +0000
commit4cd5791f4aa6deb572979bb38c1deedbc155efe0 (patch)
tree1cfded7c8c6851db997d70a0350cbb05dec84436 /test/Sema/format-strings.c
parente37cdc42bf7298a974dfdfa9c03ef11398e7c889 (diff)
Do not warn about empty format strings when there are no data arguments. Fixes <rdar://problem/9473155>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 20c665b978..6b5f7e2c26 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, ...)