From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26212 invoked by alias); 23 Jun 2010 08:56:48 -0000 Received: (qmail 26198 invoked by uid 22791); 23 Jun 2010 08:56:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 08:56:42 +0000 Received: by wyb40 with SMTP id 40so371704wyb.20 for ; Wed, 23 Jun 2010 01:56:40 -0700 (PDT) Received: by 10.216.91.7 with SMTP id g7mr2216116wef.93.1277283400179; Wed, 23 Jun 2010 01:56:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.38.74 with HTTP; Wed, 23 Jun 2010 01:56:20 -0700 (PDT) In-Reply-To: <4C21C7EE.4060805@oracle.com> References: <4C2060CC.3040401@oracle.com> <4C21C7EE.4060805@oracle.com> From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Wed, 23 Jun 2010 09:31:00 -0000 Message-ID: Subject: Re: [PATCH C] Fix pr44517 To: Shujing Zhao Cc: "Joseph S. Myers" , GCC Patches , Paolo Carlini Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg02293.txt.bz2 Nice improvement! Some unimportant comments: @@ -2843,8 +2828,12 @@ c_parser_parameter_declaration (c_parser { /* ??? In some Objective-C cases '...' isn't applicable so there should be a different message. */ - c_parser_error (parser, - "expected declaration specifiers or %<...%>"); + c_token *token = c_parser_peek_token (parser); + if (parser->error) + return NULL; + parser->error = true; + c_parser_set_source_position_from_token (token); + error ("unknown type name %qE", token->value); c_parser_skip_to_end_of_parameter (parser); return NULL; } The ??? comment does not make sense anymore (and without any example wasn't very useful to start with), I would propose to remove it. BTW, do you know that there is a error_at (LOCATION) function? I am not sure whether here using that is more correct (or efficient) than c_parser_set_source_position_from_token but just to let you know for future patches. +/* PR c/44517: Improve diagnostic for misspelled typename in function declaration. */ +int foo(int x, pid_t y, long z, in t) { /* { dg-error "unknown type name.*pid_t|unknown type name.*in" } */ + return x + y + z + t; +} + +int bar(int x, lon y, long z, ...){ /* { dg-error "unknown type name" { target *-*-* } 8 } */ + return; +} + +void foo(int n, int a[n], pid_t x); /* { dg-error "unknown type name" { target *-*-* } 12 } */ +void bar() {}; What is the default dg action for tests without dg-do directive? Also, I am not sure how these directives are working correctly, because the complete format is: { dg-error PATTERN COMMENT { TARGET_SPEC } LINE } so the comment is missing. As far as I know, you can drop arguments from right to left but not, for example, put a LINE and not a TARGET or COMMENT. (Unfortunate, because LINE is probably the second most used after PATTERN). BTW, you do not need LINE if the error is given in the same line as the directive dg-error. Cheers, Manuel.