[PATCH 6/6] fix -dD for never-defined #undef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux