From 92253254f77e5ebb69bc7fb6acddf4b373d3eaad Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 12 Aug 2011 11:20:16 +0200 Subject: [PATCH] give stray-semicolon warning a name --- parser.c | 2 +- warning.c | 1 + warning.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index 0cc4257..e0e2503 100644 --- 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; } diff --git a/warning.c b/warning.c index 5713d8c..6bffa2b 100644 --- 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", }, diff --git a/warning.h b/warning.h index 5aede20..dcd2bd9 100644 --- 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 -- 2.20.1