Re: [Tinycc-devel] accepting a wrong scruct declaration
Hi! I patch will be pushed to the mob. I think it does the job well 01-struct-decl.patch Description: Binary data ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] accepting a wrong scruct declaration
Hi, On Thu, 2 Apr 2015, Sergey Korshunoff wrote: Thanks. Very interesting. Then a patch must contain a -fms-extensions option too. Or we just declare this to be a non-issue. Accepting invalid source is IMHO acceptable in the scope of TCC (at least if the fix would be too involved). Ciao, Michael. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] accepting a wrong scruct declaration
Hi, On Sun, 29 Mar 2015, Sergey Korshunoff wrote: struct A { struct B { int f1; int f2; }; }; int main() { struct A a; a.f1 = 16; a.f2 = 32; } A tcc compiler must not accept this program because a struct B is only a type declaration and not a member declaration. Any tips how to fix this? Careful. The above example is non-standard C, but must be accepted as a microsoft extension. GCCs option for that is -fms-extensions . As TCC is also used on windows I expect not accepting it to lead to failures there. Ciao, Michael. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] accepting a wrong scruct declaration
Thanks. Very interesting. Then a patch must contain a -fms-extensions option too. But how to detect if struct is nested or anonymuos? ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Re: [Tinycc-devel] accepting a wrong scruct declaration
Hi! A code which must be patched diff -urN tinycc.old/tccgen.c tinycc/tccgen.c --- tinycc.old/tccgen.c 2015-03-29 11:04:47.0 +0300 +++ tinycc/tccgen.c 2015-03-30 07:36:05.0 +0300 @@ -2959,7 +2959,8 @@ type1 = btype; if (tok != ':') { type_decl(type1, ad, v, TYPE_DIRECT | TYPE_ABSTRACT); -if (v == 0 (type1.t VT_BTYPE) != VT_STRUCT) +//if (v == 0 (type1.t VT_BTYPE) != VT_STRUCT) +if (v == 0) expect(identifier); if (type_size(type1, align) 0) { if ((a == TOK_STRUCT) (type1.t VT_ARRAY) c) A rules: - external anonymous struct must have identifer - nested named struct must have identifier But I can't express this rules in the code above. The code require identifier in any case. ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel