diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-07-16 18:27:56 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-07-16 18:27:56 +0000 |
| commit | c618728e8dbc1d3cec1b945c97389b41e98bc1b2 (patch) | |
| tree | 407ca709b23c8032f586bac964de78f9a9405d44 | |
| parent | 6353e534ec84b1c3d5e562a219df7db90e7162da (diff) | |
| download | bcm5719-llvm-c618728e8dbc1d3cec1b945c97389b41e98bc1b2.tar.gz bcm5719-llvm-c618728e8dbc1d3cec1b945c97389b41e98bc1b2.zip | |
Tweak zero-field width in scanf format string diagnostic.
llvm-svn: 108541
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 5 | ||||
| -rw-r--r-- | clang/test/Sema/format-strings-scanf.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 38c8b674725..9dac3f24221 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2941,7 +2941,7 @@ def warn_printf_incomplete_specifier : Warning< def warn_missing_format_string : Warning< "format string missing">, InGroup<Format>; def warn_scanf_nonzero_width : Warning< - "conversion specifies 0 input characters for field width">, + "zero field width in scanf format string is unused">, InGroup<Format>; def warn_printf_conversion_argument_type_mismatch : Warning< "conversion specifies type %0 but the argument has type %1">, @@ -2984,6 +2984,9 @@ def warn_printf_nonsensical_length: Warning< def warn_printf_ignored_flag: Warning< "flag '%0' is ignored when flag '%1' is present">, InGroup<Format>; +def warn_scanf_scanlist_incomplete : Warning< + "scanlist not terminated in format string">, + InGroup<Format>; // CHECK: returning address/reference of stack memory def warn_ret_stack_addr : Warning< diff --git a/clang/test/Sema/format-strings-scanf.c b/clang/test/Sema/format-strings-scanf.c index cd684106937..63e81d4c742 100644 --- a/clang/test/Sema/format-strings-scanf.c +++ b/clang/test/Sema/format-strings-scanf.c @@ -9,6 +9,6 @@ int sscanf(const char * restrict, const char * restrict, ...) ; void test(const char *s, int *i) { scanf(s, i); // expected-warning{{ormat string is not a string literal}} - scanf("%0d", i); // expected-warning{{conversion specifies 0 input characters for field width}} - scanf("%00d", i); // expected-warning{{conversion specifies 0 input characters for field width}} + scanf("%0d", i); // expected-warning{{zero field width in scanf format string is unused}} + scanf("%00d", i); // expected-warning{{zero field width in scanf format string is unused}} } |

