All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 3/6] teach sparse how to handle -dD flag
Date: Tue,  4 Apr 2017 23:49:52 +0200	[thread overview]
Message-ID: <20170404214955.47926-4-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170404214955.47926-1-luc.vanoostenryck@gmail.com>

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 lib.c | 16 ++++++++++++++++
 lib.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/lib.c b/lib.c
index 272d2c88a..991ead9bd 100644
--- a/lib.c
+++ b/lib.c
@@ -250,6 +250,8 @@ int Wvla = 1;
 int dbg_entry = 0;
 int dbg_dead = 0;
 
+int dump_macro_defs = 0;
+
 int preprocess_only;
 
 static enum { STANDARD_C89,
@@ -567,6 +569,19 @@ static char **handle_switch_v(char *arg, char **next)
 	return next;
 }
 
+static struct warning dumps[] = {
+	{ "D", &dump_macro_defs},
+};
+
+static char **handle_switch_d(char *arg, char **next)
+{
+	char ** ret = handle_onoff_switch(arg, next, dumps, ARRAY_SIZE(dumps));
+	if (ret)
+		return ret;
+
+	return next;
+}
+
 
 static void handle_onoff_switch_finalize(const struct warning warnings[], int n)
 {
@@ -800,6 +815,7 @@ static char **handle_switch(char *arg, char **next)
 	switch (*arg) {
 	case 'a': return handle_switch_a(arg, next);
 	case 'D': return handle_switch_D(arg, next);
+	case 'd': return handle_switch_d(arg, next);
 	case 'E': return handle_switch_E(arg, next);
 	case 'f': return handle_switch_f(arg, next);
 	case 'g': return handle_switch_g(arg, next);
diff --git a/lib.h b/lib.h
index f2df4aa1d..1b21de0c2 100644
--- a/lib.h
+++ b/lib.h
@@ -137,6 +137,8 @@ extern int Wvla;
 extern int dbg_entry;
 extern int dbg_dead;
 
+extern int dump_macro_defs;
+
 extern int arch_m64;
 
 extern void declare_builtin_functions(void);
-- 
2.12.0


  parent reply	other threads:[~2017-04-04 21:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 21:49 [PATCH 0/6] dump macros definitions Luc Van Oostenryck
2017-04-04 21:49 ` [PATCH 1/6] define ident_list Luc Van Oostenryck
2017-04-04 21:49 ` [PATCH 2/6] teach sparse how to dump macro definitions Luc Van Oostenryck
2017-06-01  6:56   ` Christopher Li
2017-06-01 14:08     ` Luc Van Oostenryck
2017-04-04 21:49 ` Luc Van Oostenryck [this message]
2017-04-04 21:49 ` [PATCH 4/6] let -dD report macro defintions Luc Van Oostenryck
2017-04-04 21:49 ` [PATCH 5/6] let -dD report #undef too Luc Van Oostenryck
2017-04-04 21:49 ` [PATCH 6/6] fix -dD for never-defined #undef Luc Van Oostenryck
2017-04-06  8:05 ` [PATCH 0/6] dump macros definitions Christopher Li
2017-04-06 11:51   ` Luc Van Oostenryck

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=20170404214955.47926-4-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --subject='Re: [PATCH 3/6] teach sparse how to handle -dD flag' \
    /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

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.