[Firm] [PATCH] warning: Add -Wunknown-warning-option
Luca Barbato
lu_zero at gentoo.org
Tue Oct 29 04:31:34 CET 2013
Clang compatible.
---
warning.c | 3 ++-
warning.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/warning.c b/warning.c
index 6ffe763..cb49e24 100644
--- a/warning.c
+++ b/warning.c
@@ -76,6 +76,7 @@ static warning_switch_t warning[] = {
[WARN_UNUSED_VALUE] = { WARN_STATE_ON, "unused-value" },
[WARN_UNUSED_VARIABLE] = { WARN_STATE_NONE, "unused-variable" },
[WARN_WRITE_STRINGS] = { WARN_STATE_NONE, "write-strings" },
+ [WARN_UNKNOWN_WARNING_OPTION] = { WARN_STATE_ON, "unknown-warning-option" },
};
warning_switch_t const *get_warn_switch(warning_t const w)
@@ -194,7 +195,7 @@ extra:
/* GCC legacy: This way it only can be activated. */
warning[WARN_IMPLICIT_FUNCTION_DECLARATION].state = WARN_STATE_ON | WARN_STATE_ERROR;
} else {
- warningf(WARN_OTHER, NULL, "ignoring unknown option %hs%hs", "-W", opt);
+ warningf(WARN_UNKNOWN_WARNING_OPTION, NULL, "ignoring unknown option %hs%hs", "-W", opt);
}
}
diff --git a/warning.h b/warning.h
index b1dd0f5..9b53af1 100644
--- a/warning.h
+++ b/warning.h
@@ -76,6 +76,7 @@ typedef enum warning_t {
WARN_UNUSED_VALUE, /**< Warn whenever a statement computes a result that is explicitly not used */
WARN_UNUSED_VARIABLE, /**< Warn whenever a local variable or non-constant static variable is unused aside from its declaration */
WARN_WRITE_STRINGS, /**< Give string constants the type 'const char[LENGTH]' so that copying the address of one into a 'char *' pointer will get a warning */
+ WARN_UNKNOWN_WARNING_OPTION, /**< Warn whenever an unknown warning is requested */
} warning_t;
typedef enum warn_state_t {
--
1.8.3.2
More information about the Firm
mailing list