summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-01-30 15:49:20 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-01-30 15:49:20 +0000
commit19b70bd46c0e599366718050ad8cd73acbbb2e5a (patch)
tree94ea8b5d5c792a120f7d3f4939558979717dd7c9
parent842bf1736671be31378c445422662f267d366426 (diff)
downloadbcm5719-llvm-19b70bd46c0e599366718050ad8cd73acbbb2e5a.tar.gz
bcm5719-llvm-19b70bd46c0e599366718050ad8cd73acbbb2e5a.zip
Recognize 'q' as a format length modifier (from BSD).
llvm-svn: 94894
-rw-r--r--clang/include/clang/Analysis/Analyses/PrintfFormatString.h2
-rw-r--r--clang/lib/Analysis/PrintfFormatString.cpp1
-rw-r--r--clang/test/Sema/format-strings.c3
3 files changed, 4 insertions, 2 deletions
diff --git a/clang/include/clang/Analysis/Analyses/PrintfFormatString.h b/clang/include/clang/Analysis/Analyses/PrintfFormatString.h
index e2c0d232fa8..0431be143eb 100644
--- a/clang/include/clang/Analysis/Analyses/PrintfFormatString.h
+++ b/clang/include/clang/Analysis/Analyses/PrintfFormatString.h
@@ -105,7 +105,7 @@ enum LengthModifier {
AsChar, // 'hh'
AsShort, // 'h'
AsLong, // 'l'
- AsLongLong, // 'll'
+ AsLongLong, // 'll', 'q' (BSD, deprecated)
AsIntMax, // 'j'
AsSizeT, // 'z'
AsPtrDiff, // 't'
diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp
index 05b5d9cceba..d2bcbb04f9d 100644
--- a/clang/lib/Analysis/PrintfFormatString.cpp
+++ b/clang/lib/Analysis/PrintfFormatString.cpp
@@ -185,6 +185,7 @@ static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
case 'z': lm = AsSizeT; ++I; break;
case 't': lm = AsPtrDiff; ++I; break;
case 'L': lm = AsLongDouble; ++I; break;
+ case 'q': lm = AsLongLong; ++I; break;
}
FS.setLengthModifier(lm);
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 21d7770e12c..02e39a426be 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -144,7 +144,7 @@ void torture(va_list v8) {
}
-void test10(int x, float f, int i) {
+void test10(int x, float f, int i, long long lli) {
printf("%@", 12); // expected-warning{{invalid conversion specifier '@'}}
printf("\0"); // expected-warning{{format string contains '\0' within the string body}}
printf("xs\0"); // expected-warning{{format string contains '\0' within the string body}}
@@ -161,6 +161,7 @@ void test10(int x, float f, int i) {
printf("%.d", x); // no-warning
printf("%.", x); // expected-warning{{incomplete format specifier}}
printf("%f", 4); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
+ printf("%qd", lli);
}
typedef struct __aslclient *aslclient;
OpenPOWER on IntegriCloud