public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Semicolons at the end of member function definitions
       [not found] ` <46B1412F.2070402@codesourcery.com>
@ 2007-08-03 22:59   ` Volker Reichelt
  2007-08-05 19:23     ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Volker Reichelt @ 2007-08-03 22:59 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: gcc-patches

Mark Mitchell wrote:

> Volker Reichelt wrote:
> 
> > 2007-03-26  Dirk Mueller  <dmueller@suse.de>
> > 
> >        * 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  <v.reichelt@netcologne.de>

	Revert:
	2007-03-26  Dirk Mueller  <dmueller@suse.de>

	* 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  <v.reichelt@netcologne.de>

	* g++.dg/warn/pedantic2.C: Fix error marker.  Add more tests.

	Revert:
	2007-03-22  Dirk Mueller  <dmueller@suse.de>

	* 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:
===================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Semicolons at the end of member function definitions
  2007-08-03 22:59   ` Semicolons at the end of member function definitions Volker Reichelt
@ 2007-08-05 19:23     ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2007-08-05 19:23 UTC (permalink / raw)
  To: Volker Reichelt; +Cc: gcc-patches

Volker Reichelt wrote:

> 2007-08-03  Volker Reichelt  <v.reichelt@netcologne.de>
> 
> 	Revert:
> 	2007-03-26  Dirk Mueller  <dmueller@suse.de>
> 
> 	* parser.c (cp_parser_member_declaration): Pedwarn
> 	about stray semicolons after member declarations.

> 2007-08-03  Volker Reichelt  <v.reichelt@netcologne.de>
> 
> 	* g++.dg/warn/pedantic2.C: Fix error marker.  Add more tests.
> 
> 	Revert:
> 	2007-03-22  Dirk Mueller  <dmueller@suse.de>
> 
> 	* g++.old-deja/g++.brendan/warnings2.C: Don't use -pedantic.

OK.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-05 19:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tkrat.6fde7d1faf6cb977@netcologne.de>
     [not found] ` <46B1412F.2070402@codesourcery.com>
2007-08-03 22:59   ` Semicolons at the end of member function definitions Volker Reichelt
2007-08-05 19:23     ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).