All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: linux-sparse@vger.kernel.org
Subject: [PATCH] Support -Wall flag
Date: Tue, 01 Aug 2006 13:50:08 -0400	[thread overview]
Message-ID: <20060801175008.11809.99999.stgit@dv.roinet.com> (raw)

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;

             reply	other threads:[~2006-08-01 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 17:50 Pavel Roskin [this message]
2006-12-05 10:57 ` [PATCH] Support -Wall flag Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060801175008.11809.99999.stgit@dv.roinet.com \
    --to=proski@gnu.org \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.