diff mbox

[C++] PR 50454

Message ID 4E78A0EE.7050707@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 20, 2011, 2:19 p.m. UTC
On 09/20/2011 03:45 PM, Paolo Carlini wrote:
> On 09/20/2011 03:12 PM, Jason Merrill wrote:
>> No, I think we want to complain about __int128 when -pedantic unless 
>> we're in a system header, as C does.  The right fix is to move the 
>> __int128 code out of the if (unsigned_p || ...) block, and to 
>> suppress the pedwarn when in_system_header.
> Ok, I'll do it...
As a preview, something as simple as the below appears to do what we 
want. I'll test it later with testcases (I think we want two: one 
testing sane error messages for a normal run of the testsuite; one 
testing the in_system_header suppression with the snippet included as a 
*.h), repost...

Thanks,
Paolo.

Comments

Jason Merrill Sept. 20, 2011, 6:49 p.m. UTC | #1
On 09/20/2011 10:19 AM, Paolo Carlini wrote:
> +  if (explicit_int128 && pedantic && ! in_system_header)
> +    pedwarn (input_location, OPT_pedantic,
> +	     "ISO C++ does not support %<__int128%> for %qs", name);

Yep, like that.  But we also want the check for null integer128_type_node.

Jason
Paolo Carlini Sept. 20, 2011, 6:59 p.m. UTC | #2
Hi,

> On 09/20/2011 10:19 AM, Paolo Carlini wrote:
>> +  if (explicit_int128 && pedantic && ! in_system_header)
>> +    pedwarn (input_location, OPT_pedantic,
>> +         "ISO C++ does not support %<__int128%> for %qs", name);
> 
> Yep, like that.  But we also want the check for null integer128_type_node.

Thanks, I'll finalize the patch later today. Actually I was pretty sure that the check wasn't strictly necessary, ie, we reject __int128 anyway if isn't really available (ie, my first try didn't ice on the testcase without the dg-require on x86_64 -m32) But maybe it's matter of producing a clearer diagnostic? I'll double check..

Thanks,
Paolo
diff mbox

Patch

Index: decl.c
===================================================================
--- decl.c	(revision 179007)
+++ decl.c	(working copy)
@@ -8640,6 +8640,10 @@  grokdeclarator (const cp_declarator *declarator,
 
   ctype = NULL_TREE;
 
+  if (explicit_int128 && pedantic && ! in_system_header)
+    pedwarn (input_location, OPT_pedantic,
+	     "ISO C++ does not support %<__int128%> for %qs", name);
+
   /* Now process the modifiers that were specified
      and check for invalid combinations.  */
 
@@ -8695,22 +8699,6 @@  grokdeclarator (const cp_declarator *declarator,
 	      if (flag_pedantic_errors)
 		ok = 0;
 	    }
-	  if (explicit_int128)
-	    {
-	      if (int128_integer_type_node == NULL_TREE)
-	        {
-		  error ("%<__int128%> is not supported by this target");
-		  ok = 0;
-	        }
-	      else if (pedantic)
-		{
-		  pedwarn (input_location, OPT_pedantic,
-			   "ISO C++ does not support %<__int128%> for %qs",
-			   name);
-		  if (flag_pedantic_errors)
-		    ok = 0;
-		}
-	    }
 	}
 
       /* Discard the type modifiers if they are invalid.  */