From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21561 invoked by alias); 3 Aug 2007 22:59:22 -0000 Received: (qmail 21423 invoked by uid 22791); 3 Aug 2007 22:59:21 -0000 X-Spam-Check-By: sourceware.org Received: from smtp3.netcologne.de (HELO smtp3.netcologne.de) (194.8.194.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 03 Aug 2007 22:59:18 +0000 Received: from xdsl-87-78-94-65.netcologne.de (xdsl-87-78-94-65.netcologne.de [87.78.94.65]) by smtp3.netcologne.de (Postfix) with ESMTP id 5551767BF5; Sat, 4 Aug 2007 00:59:15 +0200 (CEST) Date: Fri, 03 Aug 2007 22:59:00 -0000 From: Volker Reichelt Subject: Re: Semicolons at the end of member function definitions To: Mark Mitchell cc: gcc-patches@gcc.gnu.org In-Reply-To: <46B1412F.2070402@codesourcery.com> Message-ID: References: <46B1412F.2070402@codesourcery.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE 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: 2007-08/txt/msg00221.txt.bz2 Mark Mitchell wrote: > Volker Reichelt wrote: > > > 2007-03-26 Dirk Mueller > > > > * parser.c (cp_parser_member_declaration): Pedwarn > > about stray semicolons after member declarations. > > [...] > > Therefore, IMHO the patch is wrong and should be reverted. > > Yes, please go ahead and revert it. And, if you have time, please add a > test-case specifically for this case. The previous patch removed > semicolons from lots of valid code, but probably none of those test > cases were specifically for this case. How about the patch below? First of all, it reverts the changes to the compiler. It doesn't revert all the changes to the testcases, though: Most of the changes of Dirk's patch can be interpreted as changes to the coding style. It didn't seem worth the hassle to introduce all the semicolons back. There are only two testcases that do not fall into this category: g++.old-deja/g++.brendan/warnings2.C: To me the test case looks like it was designed to ensure that the compiler accepts the valid semicolons. Therefore I simply reverted it to the previous version. g++.dg/warn/pedantic2.C: This test was introduced to check for "invalid" semicolons. Instead of just deleting it I fixed the error marker and added some more tests to make sure that we accept one semicolon, but not two. Bootstrapped and regtested on i686-pc-linux-gnu. Ok for mainline? Regards, Volker 2007-08-03 Volker Reichelt Revert: 2007-03-26 Dirk Mueller * parser.c (cp_parser_member_declaration): Pedwarn about stray semicolons after member declarations. =================================================================== --- gcc/gcc/cp/parser.c 2007/03/26 23:17:16 123248 +++ gcc/gcc/cp/parser.c 2007/03/27 00:15:29 123249 @@ -15001,11 +15001,7 @@ token = cp_lexer_peek_token (parser->lexer); /* If the next token is a semicolon, consume it. */ if (token->type == CPP_SEMICOLON) - { - if (pedantic && !in_system_header) - pedwarn ("extra %<;%>"); - cp_lexer_consume_token (parser->lexer); - } + cp_lexer_consume_token (parser->lexer); return; } else =================================================================== 2007-08-03 Volker Reichelt * g++.dg/warn/pedantic2.C: Fix error marker. Add more tests. Revert: 2007-03-22 Dirk Mueller * g++.old-deja/g++.brendan/warnings2.C: Don't use -pedantic. =================================================================== --- gcc/gcc/testsuite/g++.dg/warn/pedantic2.C 2007-03-31 21:39:59 +0200 +++ gcc/gcc/testsuite/g++.dg/warn/pedantic2.C 2007-08-04 03:13:59 +0200 @@ -2,5 +2,9 @@ class foo { - foo() {}; // { dg-error "extra" } + foo() {}; + void bar() {}; + + foo(int) {};; // { dg-error "extra" } + void bar(int) {};; // { dg-error "extra" } }; =================================================================== --- gcc/gcc/testsuite/g++.old-deja/g++.brendan/warnings2.C 2007-03-23 23:35:36 +0100 +++ gcc/gcc/testsuite/g++.old-deja/g++.brendan/warnings2.C 2007-08-04 03:33:13 +0200 @@ -1,5 +1,4 @@ -// { dg-do compile } -// { dg-options "-Wall -Wextra" } +// { dg-do assemble } // GROUPS passed warnings class K { public: ===================================================================