linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adding anonymous string
@ 2006-12-20  2:34 Christopher Li
  0 siblings, 0 replies; only message in thread
From: Christopher Li @ 2006-12-20  2:34 UTC (permalink / raw)
  To: linux-sparse; +Cc: Josh Triplett, Linus Torvalds

Anonymous string is one exception that the back end does
need to generate storage on (read only) data section.

Currently in order to determine a symbol is anonymous string,
we can test:
	symbol is array
	and symbol has no ident.
	and symbol base type is char.
	and symbol initializer is a string expression.

This patch add a bitfield to easier identify an anonymous string.

Signed-off-by: Christopher Li <sparse@chrisli.org>

Index: sparse/symbol.h
===================================================================
--- sparse.orig/symbol.h	2006-12-12 02:04:05.000000000 -0800
+++ sparse/symbol.h	2006-12-12 02:05:24.000000000 -0800
@@ -118,7 +118,8 @@ struct symbol {
 					initialized:1,
 					examined:1,
 					expanding:1,
-					evaluated:1;
+					evaluated:1,
+					string:1;
 			struct expression *array_size;
 			struct ctype ctype;
 			struct symbol_list *arguments;
Index: sparse/evaluate.c
===================================================================
--- sparse.orig/evaluate.c	2006-12-12 02:04:05.000000000 -0800
+++ sparse/evaluate.c	2006-12-12 02:05:24.000000000 -0800
@@ -74,6 +74,7 @@ static struct symbol *evaluate_string(st
 	sym->array_size = alloc_const_expression(expr->pos, length);
 	sym->bit_size = bits_in_char * length;
 	sym->ctype.alignment = 1;
+	sym->string = 1;
 	sym->ctype.modifiers = MOD_STATIC;
 	sym->ctype.base_type = array;
 	sym->initializer = initstr;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-20  2:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-20  2:34 [PATCH] adding anonymous string Christopher Li

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).