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 6/6] fix -dD for never-defined #undef
Date: Tue,  4 Apr 2017 23:49:55 +0200	[thread overview]
Message-ID: <20170404214955.47926-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170404214955.47926-1-luc.vanoostenryck@gmail.com>

Note: to support this, we have to create a symbol where
      it wasn't needed before.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 pre-process.c                         | 3 +--
 validation/preprocessor/dump-macros.c | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/pre-process.c b/pre-process.c
index 63df3f71c..5067b59b2 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -1400,8 +1400,7 @@ static int do_handle_undef(struct stream *stream, struct token **line, struct to
 			return 1;
 		if (attr == sym->attr && sym->namespace == NS_UNDEF)
 			return 1;
-	} else if (attr <= SYM_ATTR_NORMAL)
-		return 1;
+	}
 
 	if (!sym || sym->scope != file_scope) {
 		sym = alloc_symbol(left->pos, SYM_NODE);
diff --git a/validation/preprocessor/dump-macros.c b/validation/preprocessor/dump-macros.c
index 5508233aa..a10325171 100644
--- a/validation/preprocessor/dump-macros.c
+++ b/validation/preprocessor/dump-macros.c
@@ -6,9 +6,11 @@
 #define DEF xyz
 
 #define NYDEF ydef
+
+#undef	NDEF2
 /*
  * check-name: dump-macros
- * check-command: sparse -E -dD -DIJK=ijk -UNDEF -UNYDEF $file
+ * check-command: sparse -E -dD -DIJK=ijk -UNDEF1 -UNYDEF $file
  *
  * check-output-ignore
 check-output-pattern-1-times: #define __CHECKER__ 1
@@ -16,4 +18,6 @@ check-output-contains: #define IJK ijk
 check-output-contains: #define DEF xyz
 check-output-contains: #define NYDEF ydef
 check-output-contains: #undef ABC
+check-output-contains: #undef NDEF1
+check-output-contains: #undef NDEF2
  */
-- 
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 ` [PATCH 3/6] teach sparse how to handle -dD flag Luc Van Oostenryck
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 ` Luc Van Oostenryck [this message]
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-7-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --subject='Re: [PATCH 6/6] fix -dD for never-defined #undef' \
    /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.