linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dissect: use built_in_ident() instead of MK_IDENT()
@ 2017-06-19 21:14 Luc Van Oostenryck
  2017-06-19 22:35 ` Ramsay Jones
  2017-06-20 11:17 ` Oleg Nesterov
  0 siblings, 2 replies; 8+ messages in thread
From: Luc Van Oostenryck @ 2017-06-19 21:14 UTC (permalink / raw)
  To: linux-sparse; +Cc: Chris Li, Luc Van Oostenryck, Oleg Nesterov

The motivation for this patch was to allow sparse to be
compiled with clang which doesn't like what is done
on VLAs in the MK_IDENT() macro.

But also, I can't see any justification for not using the
real thing to create identifiers: built_in_ident().

CC: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 dissect.h      | 13 -------------
 test-dissect.c |  6 +++---
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/dissect.h b/dissect.h
index 3b72b8988..5ac1f4d40 100644
--- a/dissect.h
+++ b/dissect.h
@@ -25,16 +25,3 @@ struct reporter
 };
 
 extern void dissect(struct symbol_list *, struct reporter *);
-
-#define	MK_IDENT(s)	({				\
-	static struct {					\
-		struct ident ident;			\
-		char __[sizeof(s)];			\
-	} ident = {{					\
-		.len  = sizeof(s)-1,			\
-		.name = s,				\
-	}};						\
-	&ident.ident;					\
-})
-
-#endif
diff --git a/test-dissect.c b/test-dissect.c
index a2548b7f2..862318f81 100644
--- a/test-dissect.c
+++ b/test-dissect.c
@@ -47,7 +47,7 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
 	print_usage(pos, sym, mode);
 
 	if (!sym->ident)
-		sym->ident = MK_IDENT("__asm__");
+		sym->ident = built_in_ident("__asm__");
 
 	printf("%-32.*s %s\n",
 		sym->ident->len, sym->ident->name,
@@ -60,10 +60,10 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
 
 	print_usage(pos, sym, mode);
 
-	ni = MK_IDENT("?");
+	ni = built_in_ident("?");
 	si = sym->ident ?: ni;
 	/* mem == NULL means entire struct accessed */
-	mi = mem ? (mem->ident ?: ni) : MK_IDENT("*");
+	mi = mem ? (mem->ident ?: ni) : built_in_ident("*");
 
 	printf("%.*s.%-*.*s %s\n",
 		si->len, si->name,
-- 
2.13.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-20 16:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-19 21:14 [PATCH] dissect: use built_in_ident() instead of MK_IDENT() Luc Van Oostenryck
2017-06-19 22:35 ` Ramsay Jones
2017-06-19 22:42   ` Luc Van Oostenryck
2017-06-20 11:17 ` Oleg Nesterov
2017-06-20 12:53   ` Luc Van Oostenryck
2017-06-20 16:07     ` Oleg Nesterov
2017-06-20 16:39       ` Luc Van Oostenryck
2017-06-20 16:56         ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).