From 2358b378b3cd526956713f033f5a0ecaa5f63951 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 6 Jan 2013 17:20:44 +0100 Subject: tccpp: alternative fix for #include_next infinite loop bug This replaces commit 3d409b08893873b917ccb8c34398bc41a4e84d7c - revert old fix in libtcc.c - #include_next: look up the file in the include stack to see if it is already included. Also: - streamline include code - remove 'type' from struct CachedInclude (obsolete because we check full filename anyway) - remove inc_type & inc_filename from struct Bufferedfile (obsolete) - fix bug with TOK_FLAG_ENDIF not being reset - unrelated: get rid of an 'variable potentially uninitialized' warning --- tccgen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tccgen.c') diff --git a/tccgen.c b/tccgen.c index 5a79f49..71555cd 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3284,8 +3284,8 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) { Sym *s; CType type1, *type2; - int qualifiers, storage, saved_nocode_wanted; - + int qualifiers, storage; + while (tok == '*') { qualifiers = 0; redo: @@ -3339,12 +3339,12 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) storage = type->t & VT_STORAGE; type->t &= ~VT_STORAGE; if (storage & VT_STATIC) { - saved_nocode_wanted = nocode_wanted; + int saved_nocode_wanted = nocode_wanted; nocode_wanted = 1; - } - post_type(type, ad); - if (storage & VT_STATIC) + post_type(type, ad); nocode_wanted = saved_nocode_wanted; + } else + post_type(type, ad); type->t |= storage; if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) parse_attribute(ad); -- cgit v1.3.1