[Bug c/20385] Lame parse error message for undefined type

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 18 18:30:00 GMT 2008



------- Comment #3 from manu at gcc dot gnu dot org  2008-08-18 18:28 -------
This is hard. Even the simple cases are hard since the error is detected very
very late. There are far too many ways to declare anything. Perhaps using a
slightly different code patch for C99 would help with -std=c99.

Deprecating the GNU C extension that allows definitions at file scope of
objects with no declaration specifiers would simplify things.

But in the end I think we would need to parse the whole declaration more or
less tentatively before figuring out which errors emit. I think not diagnosing
"unknown type" for the following testcase is ok:

unknowntype (foo)() { return 0; }

We should be worried about simpler cases like:

unknowntype f() { return 0; }
unknowntype *f() { return 0; }

int f(unknowntype a) { return 0; }
int f(unknowntype *a) { return 0; }

unknowntype a;
unknowntype *a;

and so on. Those are the ones users complain about. Also, if other compilers
get them right, then surely we can get them right as well. Now we only need
some brave volunteer to implement it ;-)


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Lame error message for      |Lame parse error message for
                   |undefined type              |undefined type


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20385



More information about the Gcc-bugs mailing list