Hi I've push a new version that use skip_or_save_block from mob: https://github.com/cosmo-ray/tcc/commits/mob I've let the patch that change ex1.c that I used as testing so you can see my ugly tests.
On Tue, Jul 4, 2017 at 4:46 PM, Michael Matz <[email protected]> wrote: > Hi, > > On Tue, 4 Jul 2017, Michael Matz wrote: > >> Ugh, you're right. Indeed the standard doesn't mandate a const char[] >> type for string literals (I was confused because it does say that >> modification of string literals is undefined, i.e. that's an extension). >> Let me work on this a bit. > > Actually, not much need for work. I've checked GCC sources and, even > though it wonders in a comment if it's a good idea to change expression > types with warning flags, it indeed does so; so if for nothing else than > compatibility I've reverted the patch. > > The hack in the current patch for _Generic (to regard string literals as > const char* always) isn't needed. GCC indeed differs in behaviour > depending on the warning flag, also in _Generic: > > ----------------------- > extern int printf(const char *,...); > int main() > { > const char *msg; > msg = _Generic("foo", const char *:"const char*", char*:"char *", > default:"something else"); > printf ("type \"foo\" = %s\n", msg); > return 0; > } > ----------------------- > % gcc-6 -Wwrite-strings x.c && ./a.out > type "foo" = const char* > % gcc-6 -Wno-write-strings x.c && ./a.out > type "foo" = char* > > So, thanks for checking after me ;) > Well, I've just test int main() { const char *msg; msg = _Generic("foo", const char *:"const char*", char*:"char *", default:"something else"); printf ("type \"foo\" = %s\n", msg); return 0; } _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
