give stray-semicolon warning a name
authorMatthias Braun <matze@braunis.de>
Fri, 12 Aug 2011 09:20:16 +0000 (11:20 +0200)
committerMatthias Braun <matze@braunis.de>
Fri, 12 Aug 2011 18:59:20 +0000 (20:59 +0200)
parser.c
warning.c
warning.h

index 0cc4257..e0e2503 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -10420,7 +10420,7 @@ static void parse_external(void)
 
                case ';':
                        if (!strict_mode) {
-                               warningf(WARN_OTHER, HERE, "stray ';' outside of function");
+                               warningf(WARN_STRAY_SEMICOLON, HERE, "stray ';' outside of function");
                                next_token();
                                return;
                        }
index 5713d8c..6bffa2b 100644 (file)
--- a/warning.c
+++ b/warning.c
@@ -64,6 +64,7 @@ static warning_switch_t warning[] = {
        [WARN_SHADOW]                        = { WARN_STATE_NONE, "shadow",                       },
        [WARN_SHADOW_LOCAL]                  = { WARN_STATE_NONE, "shadow-local",                 },
        [WARN_SIGN_COMPARE]                  = { WARN_STATE_NONE, "sign-compare",                 },
+       [WARN_STRAY_SEMICOLON]               = { WARN_STATE_ON,   "stray-semicolon",              },
        [WARN_STRICT_PROTOTYPES]             = { WARN_STATE_ON,   "strict-prototypes"             },
        [WARN_SWITCH_DEFAULT]                = { WARN_STATE_NONE, "switch-default",               },
        [WARN_SWITCH_ENUM]                   = { WARN_STATE_NONE, "switch-enum",                  },
index 5aede20..dcd2bd9 100644 (file)
--- a/warning.h
+++ b/warning.h
@@ -94,6 +94,7 @@ typedef enum warning_t {
        WARN_SHADOW,                        /**< Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed */
        WARN_SHADOW_LOCAL,
        WARN_SIGN_COMPARE,                  /**< Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned */
+       WARN_STRAY_SEMICOLON,               /**< Warn about stray semicolons outside of functions */
 #if 0 // TODO
        WARN_STRICT_ALIASING,               /**< Warn about code which might break the strict aliasing rules that the compiler is using for optimization. */
 #endif