* [PATCH] Support -Wall flag
@ 2006-08-01 17:50 Pavel Roskin
2006-12-05 10:57 ` Josh Triplett
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2006-08-01 17:50 UTC (permalink / raw)
To: linux-sparse
From: Pavel Roskin <proski@gnu.org>
If -Wall is specified, enable all warnings except those explicitly
disabled by -Wno-* switches.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
lib.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/lib.c b/lib.c
index feb755a..faafdf8 100644
--- a/lib.c
+++ b/lib.c
@@ -325,24 +325,37 @@ static const struct warning {
{ "shadow", &Wshadow },
};
+enum {
+ WARNING_OFF,
+ WARNING_ON,
+ WARNING_FORCE_OFF
+};
+
static char **handle_switch_W(char *arg, char **next)
{
- int no = 0;
+ int flag = WARNING_ON;
char *p = arg + 1;
unsigned i;
+ if (!strcmp(p, "all")) {
+ for (i = 0; i < sizeof(warnings) / sizeof(warnings[0]); i++) {
+ if (*warnings[i].flag != WARNING_FORCE_OFF)
+ *warnings[i].flag = WARNING_ON;
+ }
+ }
+
// Prefixes "no" and "no-" mean to turn warning off.
if (p[0] == 'n' && p[1] == 'o') {
p += 2;
if (p[0] == '-')
p++;
- no = 1;
+ flag = WARNING_FORCE_OFF;
}
for (i = 0; i < sizeof(warnings) / sizeof(warnings[0]); i++) {
if (!strcmp(p,warnings[i].name)) {
- *warnings[i].flag = !no;
+ *warnings[i].flag = flag;
return next;
}
}
@@ -351,6 +364,16 @@ static char **handle_switch_W(char *arg,
return next;
}
+static void handle_switch_W_finalize(void)
+{
+ unsigned i;
+
+ for (i = 0; i < sizeof(warnings) / sizeof(warnings[0]); i++) {
+ if (*warnings[i].flag == WARNING_FORCE_OFF)
+ *warnings[i].flag = WARNING_OFF;
+ }
+}
+
static char **handle_switch_U(char *arg, char **next)
{
const char *name = arg + 1;
@@ -608,6 +631,7 @@ struct symbol_list *sparse_initialize(in
*/
argv[files++] = arg;
}
+ handle_switch_W_finalize();
list = NULL;
argv[files] = NULL;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-12-05 10:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-01 17:50 [PATCH] Support -Wall flag Pavel Roskin
2006-12-05 10:57 ` Josh Triplett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).