summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTom Care <tcare@apple.com>2010-06-21 21:21:01 +0000
committerTom Care <tcare@apple.com>2010-06-21 21:21:01 +0000
commit3f272b853f60472c71209ce48ecfb7509ca67426 (patch)
tree0337dbc709131d0ca7a0e137108d3e42f119e0cd /clang/test/Sema/format-strings.c
parent24757ff75e5f1af2405ad45280bcadd6d344762c (diff)
downloadbcm5719-llvm-3f272b853f60472c71209ce48ecfb7509ca67426.tar.gz
bcm5719-llvm-3f272b853f60472c71209ce48ecfb7509ca67426.zip
Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377 Updated format string highlighting and fixits to take advantage of the new CharSourceRange class. - Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag) - Change format specifier range helper function to allow for half-open ranges (+1 to end) - Enabled previously failing tests (FIXMEs/XFAILs removed) - Small fixes and additions to format string test cases M test/Sema/format-strings.c M test/Sema/format-strings-fixit.c M lib/Frontend/TextDiagnosticPrinter.cpp M lib/Sema/SemaChecking.cpp llvm-svn: 106480
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 2f3947bc8f5..c6dee6801e8 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -1,7 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s
-// XFAIL: *
-// FIXME: temporarily marking as expected fail until whitespace highlighting
-// is fixed.
#include <stdarg.h>
typedef __typeof(sizeof(int)) size_t;
@@ -277,7 +274,8 @@ void bug7377_bad_length_mod_usage() {
// Bad optional amount use
printf("%.2c", 'a'); // expected-warning{{precision used with 'c' conversion specifier, resulting in undefined behavior}}
- printf("%1n", (void *) 0); // expected-warning{{precision used with 'n' conversion specifier, resulting in undefined behavior}} expected-warning{{use of '%n' in format string discouraged (potentially insecure)}}
+ printf("%1n", (void *) 0); // expected-warning{{field width used with 'n' conversion specifier, resulting in undefined behavior}} expected-warning{{use of '%n' in format string discouraged (potentially insecure)}}
+ printf("%.9n", (void *) 0); // expected-warning{{precision used with 'n' conversion specifier, resulting in undefined behavior}} expected-warning{{use of '%n' in format string discouraged (potentially insecure)}}
// Ignored flags
printf("% +f", 1.23); // expected-warning{{flag ' ' is ignored when flag '+' is present}}
OpenPOWER on IntegriCloud