diff mbox series

nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl

Message ID 8f2b8bb3-c30d-4d57-9be8-31618c168cf2@baylibre.com
State New
Headers show
Series nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl | expand

Commit Message

Tobias Burnus April 3, 2024, 12:06 p.m. UTC
Nvptx's mkoffload.cc contains 14 'fatal_error' calls and one 'warning_at' call,
which stands out more clearly (color, bold) when enabling
   diagnostic_color_init
which this patch does. — Additionally, the call gcc_init_libintl permits that
the already translated error messages also show up as translation.

OK for mainline?

Tobias

PS: Example: 'nvptx mkoffload:' is bold and 'fatal error:' is in red
in English and some language variants.

nvptx mkoffload: fatal error: COLLECT_GCC must be set.
nvptx mkoffload: 致命的エラー: COLLECT_GCC must be set.
nvptx mkoffload: erreur fatale: COLLECT_GCC doit être défini.
nvptx mkoffload: schwerwiegender Fehler: COLLECT_GCC muss gesetzt sein.

(BTW: It looks as if many languages did not translate the error string
itself, e.g. jp or zh or pl or zh_TW/zh_CN or fi or ...)

Comments

Thomas Schwinge April 4, 2024, 7:17 p.m. UTC | #1
Hi Tobias!

On 2024-04-03T14:06:45+0200, Tobias Burnus <tburnus@baylibre.com> wrote:
> Nvptx's mkoffload.cc contains 14 'fatal_error' calls and one 'warning_at' call,
> which stands out more clearly (color, bold) when enabling
>    diagnostic_color_init
> which this patch does. — Additionally, the call gcc_init_libintl permits that
> the already translated error messages also show up as translation.
>
> OK for mainline?

OK, thanks.


Grüße
 Thomas


> PS: Example: 'nvptx mkoffload:' is bold and 'fatal error:' is in red
> in English and some language variants.
>
> nvptx mkoffload: fatal error: COLLECT_GCC must be set.
> nvptx mkoffload: 致命的エラー: COLLECT_GCC must be set.
> nvptx mkoffload: erreur fatale: COLLECT_GCC doit être défini.
> nvptx mkoffload: schwerwiegender Fehler: COLLECT_GCC muss gesetzt sein.
>
> (BTW: It looks as if many languages did not translate the error string
> itself, e.g. jp or zh or pl or zh_TW/zh_CN or fi or ...)

> nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl
>
> gcc/ChangeLog:
>
> 	* config/nvptx/mkoffload.cc (main): Call
> 	gcc_init_libintl and diagnostic_color_init.
>
>  gcc/config/nvptx/mkoffload.cc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
> index a7fc28cbd3f..503b1abcefd 100644
> --- a/gcc/config/nvptx/mkoffload.cc
> +++ b/gcc/config/nvptx/mkoffload.cc
> @@ -638,7 +638,9 @@ main (int argc, char **argv)
>    const char *outname = 0;
>  
>    progname = tool_name;
> +  gcc_init_libintl ();
>    diagnostic_initialize (global_dc, 0);
> +  diagnostic_color_init (global_dc);
>  
>    if (atexit (mkoffload_cleanup) != 0)
>      fatal_error (input_location, "atexit failed");
diff mbox series

Patch

nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl

gcc/ChangeLog:

	* config/nvptx/mkoffload.cc (main): Call
	gcc_init_libintl and diagnostic_color_init.

 gcc/config/nvptx/mkoffload.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index a7fc28cbd3f..503b1abcefd 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -638,7 +638,9 @@  main (int argc, char **argv)
   const char *outname = 0;
 
   progname = tool_name;
+  gcc_init_libintl ();
   diagnostic_initialize (global_dc, 0);
+  diagnostic_color_init (global_dc);
 
   if (atexit (mkoffload_cleanup) != 0)
     fatal_error (input_location, "atexit failed");