diff mbox

[gomp4] lto error message

Message ID 56269C05.6030502@acm.org
State New
Headers show

Commit Message

Nathan Sidwell Oct. 20, 2015, 7:54 p.m. UTC
Another small cleanup I noticed.  We can use %qD to print a decl name.

Applied to gomp4 branch.

nathan

Comments

Ilya Verbin Oct. 20, 2015, 8:20 p.m. UTC | #1
On Tue, Oct 20, 2015 at 15:54:45 -0400, Nathan Sidwell wrote:
> @@ -1209,16 +1209,11 @@ input_overwrite_node (struct lto_file_de
>  
>    if (!success)
>      {
> -      if (flag_openacc)
> -	{
> -	  if (TREE_CODE (node->decl) == FUNCTION_DECL)
> -	    error ("Missing routine function %<%s%>", node->name ());
> -	  else
> -	    error ("Missing declared variable %<%s%>", node->name ());
> -	}
> -
> +      gcc_assert (flag_openacc);
> +      if (TREE_CODE (node->decl) == FUNCTION_DECL)
> +	error ("missing OpenACC %<routine%> function %qD", node->decl);
>        else
> -	gcc_unreachable ();
> +	error ("missing OpenACC %<declare%> variable %qD", node->decl);
>      }
>  }

There might be a situation when some func or var is lost during regular LTO,
even if flag_openacc is present.  In this case "missing OpenACC ..." message
would be wrong.  And if flag_openacc is absent, gcc_assert (flag_openacc) is a
bit confusing.  We disscussed this with Cesar here:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02076.html

  -- Ilya
Nathan Sidwell Oct. 20, 2015, 8:25 p.m. UTC | #2
On 10/20/15 16:20, Ilya Verbin wrote:
> On Tue, Oct 20, 2015 at 15:54:45 -0400, Nathan Sidwell wrote:

> There might be a situation when some func or var is lost during regular LTO,
> even if flag_openacc is present.  In this case "missing OpenACC ..." message
> would be wrong.  And if flag_openacc is absent, gcc_assert (flag_openacc) is a
> bit confusing.  We disscussed this with Cesar here:
> https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02076.html

Ok. During porting I fell over the error and noticed it could be simplified.  As 
it happens, I don't  need this patch for the stuff I'm moving at the moment.


nathan
diff mbox

Patch

2015-10-20  Nathan Sidwell  <nathan@codesourcery.com>

	* lto-cgraph.c (input_overwrite_node): Cleanup openacc diagnostic
	emission.

Index: gcc/lto-cgraph.c
===================================================================
--- gcc/lto-cgraph.c	(revision 229094)
+++ gcc/lto-cgraph.c	(working copy)
@@ -1209,16 +1209,11 @@  input_overwrite_node (struct lto_file_de
 
   if (!success)
     {
-      if (flag_openacc)
-	{
-	  if (TREE_CODE (node->decl) == FUNCTION_DECL)
-	    error ("Missing routine function %<%s%>", node->name ());
-	  else
-	    error ("Missing declared variable %<%s%>", node->name ());
-	}
-
+      gcc_assert (flag_openacc);
+      if (TREE_CODE (node->decl) == FUNCTION_DECL)
+	error ("missing OpenACC %<routine%> function %qD", node->decl);
       else
-	gcc_unreachable ();
+	error ("missing OpenACC %<declare%> variable %qD", node->decl);
     }
 }