diff mbox

[C++] PR43824 pedantic with inline namespaces

Message ID AANLkTi=a4CZwY+F7-NKO4mdVOT10aVdG2jmaYs40MoTh@mail.gmail.com
State New
Headers show

Commit Message

Rodrigo Rivas Aug. 23, 2010, 2:45 p.m. UTC
> I'd prefer to add this warning to maybe_warn_cxx0x and then just call that
> function here.
No problem, how about this?

Regards.
Rodrigo.

Comments

Jason Merrill Aug. 24, 2010, 5:06 a.m. UTC | #1
On 08/23/2010 07:45 AM, Rodrigo Rivas wrote:
>> I'd prefer to add this warning to maybe_warn_cxx0x and then just call that
>> function here.
> No problem, how about this?

That looks OK, but it needs a ChangeLog entry.  And I'm surprised that 
the testsuite didn't need any changes as a result; did you run make 
check-c++?

Jason
diff mbox

Patch

Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c	(revision 163449)
+++ gcc/cp/error.c	(working copy)
@@ -3029,6 +3029,11 @@  maybe_warn_cpp0x (cpp0x_warn_str str)
 		 "defaulted and deleted functions "
 		 "only available with -std=c++0x or -std=gnu++0x");
 	break;	
+      case CPP0X_INLINE_NAMESPACES:
+	pedwarn (input_location, 0,
+		 "inline namespaces "
+		 "only available with -std=c++0x or -std=gnu++0x");
+	break;	
       default:
 	gcc_unreachable();
       }
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 163449)
+++ gcc/cp/parser.c	(working copy)
@@ -13246,6 +13447,7 @@  cp_parser_namespace_definition (cp_parser* parser)

   if (cp_lexer_next_token_is_keyword (parser->lexer, RID_INLINE))
     {
+      maybe_warn_cpp0x (CPP0X_INLINE_NAMESPACES);
       is_inline = true;
       cp_lexer_consume_token (parser->lexer);
     }
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 163449)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -387,7 +387,9 @@  typedef enum cpp0x_warn_str
   /* scoped enums */
   CPP0X_SCOPED_ENUMS,
   /* defaulted and deleted functions */
-  CPP0X_DEFAULTED_DELETED
+  CPP0X_DEFAULTED_DELETED,
+  /* inline namespaces */
+  CPP0X_INLINE_NAMESPACES
 } cpp0x_warn_str;

 /* The various kinds of operation used by composite_pointer_type. */