summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings-fixit-ssize_t.c
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <shal1t712@gmail.com>2017-07-20 20:11:47 +0000
committerAlexander Shaposhnikov <shal1t712@gmail.com>2017-07-20 20:11:47 +0000
commit593e4bbf4ebac52f8a8c69bf804c67affcbb1c69 (patch)
treee5544a29e6afa9593e54b507b8212f6f35b17d87 /clang/test/Sema/format-strings-fixit-ssize_t.c
parentbb76d48d59b2903b15827fdd2b7598e6fcc0cdb8 (diff)
downloadbcm5719-llvm-593e4bbf4ebac52f8a8c69bf804c67affcbb1c69.tar.gz
bcm5719-llvm-593e4bbf4ebac52f8a8c69bf804c67affcbb1c69.zip
[clang] Fix handling of "%zd" in scanf
This diff addresses FIXMEs in lib/Analysis/ScanfFormatString.cpp for the case of ssize_t format specifier and adds tests. In particular, this change enables Clang to emit a warning on incorrect using of "%zd"/"%zn". Test plan: make check-all Differential revision: https://reviews.llvm.org/D35652 llvm-svn: 308662
Diffstat (limited to 'clang/test/Sema/format-strings-fixit-ssize_t.c')
-rw-r--r--clang/test/Sema/format-strings-fixit-ssize_t.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/test/Sema/format-strings-fixit-ssize_t.c b/clang/test/Sema/format-strings-fixit-ssize_t.c
index 5208a294a48..f8893a14a41 100644
--- a/clang/test/Sema/format-strings-fixit-ssize_t.c
+++ b/clang/test/Sema/format-strings-fixit-ssize_t.c
@@ -1,7 +1,7 @@
// RUN: cp %s %t
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -pedantic -Wall -fixit %t
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -pedantic -Wall -Werror %t
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -E -o - %t | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c99 -pedantic -Wall -fixit %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c99 -fsyntax-only -pedantic -Wall -Werror %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c99 -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
@@ -9,10 +9,14 @@
compile cleanly with -Werror -pedantic. */
int printf(char const *, ...);
+int scanf(const char *, ...);
void test() {
typedef signed long int ssize_t;
printf("%f", (ssize_t) 42);
+ ssize_t s;
+ scanf("%f", &s);
}
// CHECK: printf("%zd", (ssize_t) 42);
+// CHECK: scanf("%zd", &s)
OpenPOWER on IntegriCloud