Check for dangling % in format strings after consuming modifiers.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 19 May 2012 07:18:48 +0000 (09:18 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sat, 19 May 2012 08:10:37 +0000 (10:10 +0200)
format_check.c

index f808b11..332c9c6 100644 (file)
@@ -144,10 +144,6 @@ static int internal_check_printf_format(const expression_t *fmt_expr,
                        continue;
                fmt = *(++c);
 
-               if (fmt == '\0') {
-                       warningf(WARN_FORMAT, pos, "dangling %% in format string");
-                       break;
-               }
                if (fmt == '%')
                        continue;
 
@@ -322,6 +318,10 @@ break_fmt_flags:
                                break;
                }
 
+               if (fmt == '\0') {
+                       warningf(WARN_FORMAT, pos, "dangling %% in format string");
+                       break;
+               }
 
                type_t            *expected_type;
                type_qualifiers_t  expected_qual = TYPE_QUALIFIER_NONE;