public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-cfg: Make the verifier returns_twice message translatable
@ 2024-04-12  7:57 Jakub Jelinek
  2024-04-12  8:37 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2024-04-12  7:57 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

While translation of the verifier messages is questionable, that case is
something that ideally should never happen except to gcc developers
and so pressumably English should be fine, we use error etc. APIs and
those imply translatations and some translators translate it.
The following patch adjusts the code such that we don't emit
appel returns_twice est not first dans le bloc de base 33
in French (i.e. 2 English word in the middle of a French message).
Similarly Swedish or Ukrainian. 
Note, the German translator did differentiate between these verifier
messages vs. normal user facing and translated it to:
"Interner Fehler: returns_twice call is %s in basic block %d"
so just a German prefix before English message.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2024-04-12  Jakub Jelinek  <jakub@redhat.com>

	* tree-cfg.cc (gimple_verify_flow_info): Make the misplaced
	returns_twice diagnostics translatable.

--- gcc/tree-cfg.cc.jj	2024-04-10 10:19:04.237471564 +0200
+++ gcc/tree-cfg.cc	2024-04-11 17:18:57.962672110 +0200
@@ -5818,7 +5818,7 @@ gimple_verify_flow_info (void)
 	  if (gimple_code (stmt) == GIMPLE_CALL
 	      && gimple_call_flags (stmt) & ECF_RETURNS_TWICE)
 	    {
-	      const char *misplaced = NULL;
+	      bool misplaced = false;
 	      /* TM is an exception: it points abnormal edges just after the
 		 call that starts a transaction, i.e. it must end the BB.  */
 	      if (gimple_call_builtin_p (stmt, BUILT_IN_TM_START))
@@ -5826,18 +5826,23 @@ gimple_verify_flow_info (void)
 		  if (single_succ_p (bb)
 		      && bb_has_abnormal_pred (single_succ (bb))
 		      && !gsi_one_nondebug_before_end_p (gsi))
-		    misplaced = "not last";
+		    {
+		      error ("returns_twice call is not last in basic block "
+			     "%d", bb->index);
+		      misplaced = true;
+		    }
 		}
 	      else
 		{
-		  if (seen_nondebug_stmt
-		      && bb_has_abnormal_pred (bb))
-		    misplaced = "not first";
+		  if (seen_nondebug_stmt && bb_has_abnormal_pred (bb))
+		    {
+		      error ("returns_twice call is not first in basic block "
+			     "%d", bb->index);
+		      misplaced = true;
+		    }
 		}
 	      if (misplaced)
 		{
-		  error ("returns_twice call is %s in basic block %d",
-			 misplaced, bb->index);
 		  print_gimple_stmt (stderr, stmt, 0, TDF_SLIM);
 		  err = true;
 		}

	Jakub


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

* Re: [PATCH] tree-cfg: Make the verifier returns_twice message translatable
  2024-04-12  7:57 [PATCH] tree-cfg: Make the verifier returns_twice message translatable Jakub Jelinek
@ 2024-04-12  8:37 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-04-12  8:37 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches



> Am 12.04.2024 um 09:58 schrieb Jakub Jelinek <jakub@redhat.com>:
> 
> Hi!
> 
> While translation of the verifier messages is questionable, that case is
> something that ideally should never happen except to gcc developers
> and so pressumably English should be fine, we use error etc. APIs and
> those imply translatations and some translators translate it.
> The following patch adjusts the code such that we don't emit
> appel returns_twice est not first dans le bloc de base 33
> in French (i.e. 2 English word in the middle of a French message).
> Similarly Swedish or Ukrainian.
> Note, the German translator did differentiate between these verifier
> messages vs. normal user facing and translated it to:
> "Interner Fehler: returns_twice call is %s in basic block %d"
> so just a German prefix before English message.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok

Richard 

> 2024-04-12  Jakub Jelinek  <jakub@redhat.com>
> 
>    * tree-cfg.cc (gimple_verify_flow_info): Make the misplaced
>    returns_twice diagnostics translatable.
> 
> --- gcc/tree-cfg.cc.jj    2024-04-10 10:19:04.237471564 +0200
> +++ gcc/tree-cfg.cc    2024-04-11 17:18:57.962672110 +0200
> @@ -5818,7 +5818,7 @@ gimple_verify_flow_info (void)
>      if (gimple_code (stmt) == GIMPLE_CALL
>          && gimple_call_flags (stmt) & ECF_RETURNS_TWICE)
>        {
> -          const char *misplaced = NULL;
> +          bool misplaced = false;
>          /* TM is an exception: it points abnormal edges just after the
>         call that starts a transaction, i.e. it must end the BB.  */
>          if (gimple_call_builtin_p (stmt, BUILT_IN_TM_START))
> @@ -5826,18 +5826,23 @@ gimple_verify_flow_info (void)
>          if (single_succ_p (bb)
>              && bb_has_abnormal_pred (single_succ (bb))
>              && !gsi_one_nondebug_before_end_p (gsi))
> -            misplaced = "not last";
> +            {
> +              error ("returns_twice call is not last in basic block "
> +                 "%d", bb->index);
> +              misplaced = true;
> +            }
>        }
>          else
>        {
> -          if (seen_nondebug_stmt
> -              && bb_has_abnormal_pred (bb))
> -            misplaced = "not first";
> +          if (seen_nondebug_stmt && bb_has_abnormal_pred (bb))
> +            {
> +              error ("returns_twice call is not first in basic block "
> +                 "%d", bb->index);
> +              misplaced = true;
> +            }
>        }
>          if (misplaced)
>        {
> -          error ("returns_twice call is %s in basic block %d",
> -             misplaced, bb->index);
>          print_gimple_stmt (stderr, stmt, 0, TDF_SLIM);
>          err = true;
>        }
> 
>    Jakub
> 

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

end of thread, other threads:[~2024-04-12  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  7:57 [PATCH] tree-cfg: Make the verifier returns_twice message translatable Jakub Jelinek
2024-04-12  8:37 ` Richard Biener

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).