Author: kremenek
Date: Fri Jan 20 16:11:52 2012
New Revision: 148586

URL: http://llvm.org/viewvc/llvm-project?rev=148586&view=rev
Log:
The 'l' length modifier makes sense with the scanlist conversion specifier.

Modified:
    cfe/trunk/lib/Analysis/FormatString.cpp
    cfe/trunk/test/Sema/format-strings-scanf.c

Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=148586&r1=148585&r2=148586&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Fri Jan 20 16:11:52 2012
@@ -531,6 +531,7 @@
         case ConversionSpecifier::nArg:
         case ConversionSpecifier::cArg:
         case ConversionSpecifier::sArg:
+        case ConversionSpecifier::ScanListArg:
           return true;
         default:
           return false;

Modified: cfe/trunk/test/Sema/format-strings-scanf.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings-scanf.c?rev=148586&r1=148585&r2=148586&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings-scanf.c (original)
+++ cfe/trunk/test/Sema/format-strings-scanf.c Fri Jan 20 16:11:52 2012
@@ -71,9 +71,11 @@
   vsscanf(buf, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in 
scanf format string}}
 }
 
-void test_scanlist(int *ip, char *sp) {
+void test_scanlist(int *ip, char *sp, wchar_t *ls) {
   scanf("%[abc]", ip); // expected-warning{{format specifies type 'char *' but 
the argument has type 'int *'}}
   scanf("%h[abc]", sp); // expected-warning{{length modifier 'h' results in 
undefined behavior or no effect with '[' conversion specifier}}
+  scanf("%l[xyx]", ls); // no-warning
+  scanf("%ll[xyx]", ls); // expected-warning {{length modifier 'll' results in 
undefined behavior or no effect with '[' conversion specifier}}
 }
 
 void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
@@ -100,3 +102,4 @@
   scanf("%mC", fp); // expected-warning{{format specifies type 'wchar_t **' 
(aka 'int **') but the argument has type 'float *'}}
   scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' 
but the argument has type 'float *'}}
 }
+


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to