aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-01-24 21:29:54 +0000
committerTed Kremenek <kremenek@apple.com>2012-01-24 21:29:54 +0000
commit9d24c2cbd9cf1b7c165ccb13221f2efb2f4b49b0 (patch)
treeae2f66b9892e30f437bce30dc9bc7266319efa8b /test/Sema/format-strings.c
parent32d4abf2d1396b4434917320872a970415c08e6e (diff)
Teach scanf/printf checking about '%Ld' and friends (a GNU extension). Fixes PR 9466.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index e32ad245e3..9daaf3b0a5 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -469,3 +469,14 @@ void pr9751() {
// when the original string is within the argument expression.
printf(1 ? "yes %d" : "no %d"); // expected-warning 2{{more '%' conversions than data arguments}}
}
+
+// PR 9466: clang: doesn't know about %Lu, %Ld, and %Lx
+void printf_longlong(long long x, unsigned long long y) {
+ printf("%Ld", y); // no-warning
+ printf("%Lu", y); // no-warning
+ printf("%Lx", y); // no-warning
+ printf("%Ld", x); // no-warning
+ printf("%Lu", x); // no-warning
+ printf("%Lx", x); // no-warning
+ printf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
+}