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]

C++ PATCH: PR c++/12479


This patch makes us not issue "extra `;'" pedwarns when in system
headers.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-12-22  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12479
	* parser.c (cp_parser_declaration_seq_opt): Only issue "extra ;"
	pedwarn when not in a system header.

2003-12-22  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12479
	* g++.dg/parse/semicolon1.C: New test.
	* g++.dg/parse/semicolon1.h: Likewise.

Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.139
diff -c -5 -p -r1.139 parser.c
*** cp/parser.c	21 Dec 2003 21:07:30 -0000	1.139
--- cp/parser.c	22 Dec 2003 18:56:05 -0000
*************** cp_parser_declaration_seq_opt (cp_parser
*** 6126,6136 ****
  
        if (token->type == CPP_SEMICOLON) 
  	{
  	  /* A declaration consisting of a single semicolon is
  	     invalid.  Allow it unless we're being pedantic.  */
! 	  if (pedantic)
  	    pedwarn ("extra `;'");
  	  cp_lexer_consume_token (parser->lexer);
  	  continue;
  	}
  
--- 6126,6136 ----
  
        if (token->type == CPP_SEMICOLON) 
  	{
  	  /* A declaration consisting of a single semicolon is
  	     invalid.  Allow it unless we're being pedantic.  */
! 	  if (pedantic && !in_system_header)
  	    pedwarn ("extra `;'");
  	  cp_lexer_consume_token (parser->lexer);
  	  continue;
  	}
  
Index: testsuite/g++.dg/parse/semicolon1.C
===================================================================
RCS file: testsuite/g++.dg/parse/semicolon1.C
diff -N testsuite/g++.dg/parse/semicolon1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/semicolon1.C	22 Dec 2003 18:56:06 -0000
***************
*** 0 ****
--- 1,4 ----
+ // PR c++/12479
+ // { dg-options "-pedantic" }
+ 
+ #include "semicolon1.h"
Index: testsuite/g++.dg/parse/semicolon1.h
===================================================================
RCS file: testsuite/g++.dg/parse/semicolon1.h
diff -N testsuite/g++.dg/parse/semicolon1.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/semicolon1.h	22 Dec 2003 18:56:06 -0000
***************
*** 0 ****
--- 1,2 ----
+ #pragma GCC system_header
+ ;


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