Le dimanche 21 octobre 2012 13:51:16, Thomas Preud'homme a écrit : > Le dimanche 21 octobre 2012 13:48:18, Thomas Preud'homme a écrit : > > The second mistake is that nocode_wanted should be 1 if processing some > > static variable since it will be outside any function. This is probably > > the easiest fix but really both problems should be fixed IMHO. > > Since VLA is probably the only case where gexpr is called and hence code > might be generated, it might be just easier to check this in post_type. > Probably a one-liner or two-liner fix this way.
Not so easy in fact since type_decl, which invoke post_type, remove the VT_STATIC flag before calling post_type. Back to the nocode_wanted solution. See attached patch. Any objection for pushing this in mob? > > Thomas Best regards, Thomas.
diff --git a/tccgen.c b/tccgen.c index 71d0809..2f6e458 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3250,7 +3250,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) { Sym *s; CType type1, *type2; - int qualifiers, storage; + int qualifiers, storage, saved_nocode_wanted; while (tok == '*') { qualifiers = 0; @@ -3304,7 +3304,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; + nocode_wanted = 1; + } post_type(type, ad); + nocode_wanted = saved_nocode_wanted; type->t |= storage; if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) parse_attribute(ad);
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel