summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-01 19:22:33 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-01 19:22:33 +0000
commit80263e590562830960ddd927d0daa4dcffd76d6d (patch)
treec4c1bd6ea4ec5d6fb5e91528d073c28681a99f75 /clang/test/Sema/format-strings.c
parent718ed8a6d58b8224cc7067022e490376157a51cd (diff)
downloadbcm5719-llvm-80263e590562830960ddd927d0daa4dcffd76d6d.tar.gz
bcm5719-llvm-80263e590562830960ddd927d0daa4dcffd76d6d.zip
Allow a '0' precision in format strings (as the man page says it is okay).
Fixes <rdar://problem/7700339>. llvm-svn: 97482
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 21d3aec840f..4db775f96c9 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -170,6 +170,8 @@ void test10(int x, float f, int i, long long lli) {
printf("%d", (long long) 10); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
printf("%Lf\n", (long double) 1.0); // no-warning
printf("%f\n", (long double) 1.0); // expected-warning{{conversion specifies type 'double' but the argument has type 'long double'}}
+ // The man page says that a zero precision is okay.
+ printf("%.0Lf", (long double) 1.0); // no-warning
}
void test11(void *p, char *s) {
@@ -227,6 +229,7 @@ void test_unicode_conversions(wchar_t *s) {
// FIXME: This is probably not portable everywhere.
void test_positional_arguments() {
printf("%0$", (int)2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
+ printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
printf("%1$d", (int) 2); // no-warning
printf("%1$d", (int) 2, 2); // expected-warning{{data argument not used by format string}}
printf("%1$d%1$f", (int) 2); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
OpenPOWER on IntegriCloud