[cfe-commits] r108742 - in /cfe/trunk: lib/Analysis/ScanfFormatString.cpp test/Sema/format-strings-scanf.c

Ted Kremenek kremenek at apple.com
Mon Jul 19 12:47:40 PDT 2010


Author: kremenek
Date: Mon Jul 19 14:47:40 2010
New Revision: 108742

URL: http://llvm.org/viewvc/llvm-project?rev=108742&view=rev
Log:
Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'.  Fixes <rdar://problem/8204052>.

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

Modified: cfe/trunk/lib/Analysis/ScanfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ScanfFormatString.cpp?rev=108742&r1=108741&r2=108742&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ScanfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/ScanfFormatString.cpp Mon Jul 19 14:47:40 2010
@@ -163,6 +163,10 @@
     case 'C': k = ConversionSpecifier::CArg; break;
     case 'S': k = ConversionSpecifier::SArg; break;
     case '[': k = ConversionSpecifier::ScanListArg; break;
+    case 'u': k = ConversionSpecifier::uArg; break;
+    case 'x': k = ConversionSpecifier::xArg; break;
+    case 'o': k = ConversionSpecifier::oArg; break;
+    case 's': k = ConversionSpecifier::sArg; break;
   }
   ConversionSpecifier CS(conversionPosition, k);
   if (k == ConversionSpecifier::ScanListArg) {

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=108742&r1=108741&r2=108742&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings-scanf.c (original)
+++ cfe/trunk/test/Sema/format-strings-scanf.c Mon Jul 19 14:47:40 2010
@@ -12,4 +12,7 @@
   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}}
   scanf("%d%[asdfasdfd", i, s); // expected-warning{{no closing ']' for '%[' in scanf format string}}
+
+  unsigned short s_x;
+  scanf ("%" "hu" "\n", &s_x); // no-warning
 }





More information about the cfe-commits mailing list