This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH C] Fix pr44517


On Thu, 24 Jun 2010, Shujing Zhao wrote:

> Thanks. According to the above discussion, if the token type is CPP_NAME and
> the followed token is not ')' or ',', the error message would be "unknown type
> name %qE". If the token type is CPP_NAME, but followed by ',' or ')', it looks
> like only parameter name is declared and declaration specifier is missed. The
> old message is more appropriate. If the token type is CPP_KEYWORD, such as

Rather than saying the old message is more appropriate, I'd say that you 
can't really tell the difference between (int, pid_t) where a type was 
undeclared and (int a, b) where a type name is needed before "b".  So 
perhaps the messages should say that either a type is undeclared or a type 
is missing before a parameter name.  (Actually, I'd guess that almost all 
function prototypes either name all parameters or no parameters, so in the 
first case it's a very good guess that pid_t is a type and in the second 
it's a very good guess that b is a parameter name.  But that's definitely 
an enhancement for the future.)

The patch is OK without further code changes needed but with one testcase 
fix:

> +int f1(int x, pid_t y, long z, in t) {  /* { dg-error "unknown type name 'pid_t'|unknown type name 'in'" } */

Please use two separate dg-error directives to match the two separate 
error messages.  The second one would use the form with a line number, { 
dg-error "message" "test name" { target *-*-* } line-number }.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]