[PATCH 5/6] let -dD report #undef too

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

 



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

diff --git a/pre-process.c b/pre-process.c
index 74414dfeb..63df3f71c 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -1406,6 +1406,7 @@ static int do_handle_undef(struct stream *stream, struct token **line, struct to
 	if (!sym || sym->scope != file_scope) {
 		sym = alloc_symbol(left->pos, SYM_NODE);
 		bind_symbol(sym, left->ident, NS_MACRO);
+		add_ident(&macros, left->ident);
 	}
 
 	sym->namespace = NS_UNDEF;
@@ -2063,5 +2064,7 @@ void dump_macro_definitions(void)
 		struct symbol *sym = lookup_macro(name);
 		if (sym)
 			dump_macro(sym);
+		else
+			printf("#undef %s\n", show_ident(name));
 	} END_FOR_EACH_PTR(name);
 }
diff --git a/validation/preprocessor/dump-macros.c b/validation/preprocessor/dump-macros.c
index 79f3de6a2..5508233aa 100644
--- a/validation/preprocessor/dump-macros.c
+++ b/validation/preprocessor/dump-macros.c
@@ -15,4 +15,5 @@ check-output-pattern-1-times: #define __CHECKER__ 1
 check-output-contains: #define IJK ijk
 check-output-contains: #define DEF xyz
 check-output-contains: #define NYDEF ydef
+check-output-contains: #undef ABC
  */
-- 
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