public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl
@ 2024-04-03 12:06 Tobias Burnus
  2024-04-04 19:17 ` Thomas Schwinge
  2024-04-05 12:17 ` nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing (was: [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl) Thomas Schwinge
  0 siblings, 2 replies; 3+ messages in thread
From: Tobias Burnus @ 2024-04-03 12:06 UTC (permalink / raw)
  To: gcc-patches, Tom de Vries, Thomas Schwinge

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

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

[-- Attachment #2: nvptx-mkoffload.diff --]
[-- Type: text/x-patch, Size: 733 bytes --]

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");

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

* Re: [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl
  2024-04-03 12:06 [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl Tobias Burnus
@ 2024-04-04 19:17 ` Thomas Schwinge
  2024-04-05 12:17 ` nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing (was: [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl) Thomas Schwinge
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2024-04-04 19:17 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc-patches, Tom de Vries

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");

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

* nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing (was: [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl)
  2024-04-03 12:06 [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl Tobias Burnus
  2024-04-04 19:17 ` Thomas Schwinge
@ 2024-04-05 12:17 ` Thomas Schwinge
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2024-04-05 12:17 UTC (permalink / raw)
  To: Tobias Burnus, gcc-patches; +Cc: Tom de Vries

[-- Attachment #1: Type: text/plain, Size: 2256 bytes --]

Hi!

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?

But you've not regression-tested this?  Pushed to trunk branch
commit 679f81a32f706645f45900fdb1659fb5fe607f77
"nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing",
see attached.


Instead of adding support for all the '-fdiagnostics-color' variants, I
suppose we should rather switch the 'mkoffload's to use GCC's standard
option handling machinery (like in 'gcc/lto-wrapper.cc', for example)?


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");



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-nvptx-In-mkoffload.cc-call-diagnostic_color_init-gcc.patch --]
[-- Type: text/x-diff, Size: 1600 bytes --]

From 679f81a32f706645f45900fdb1659fb5fe607f77 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Fri, 5 Apr 2024 14:04:53 +0200
Subject: [PATCH] nvptx: In mkoffload.cc, call diagnostic_color_init +
 gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing

With commit 7520a4992c94254016085a461c58c972497c4483
"nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl",
we regressed:

    [-PASS:-]{+FAIL:+} libgomp.c/reverse-offload-sm30.c  at line 15 (test for warnings, line )
    [-PASS:-]{+FAIL:+} libgomp.c/reverse-offload-sm30.c (test for excess errors)

	libgomp/
	* testsuite/libgomp.c/reverse-offload-sm30.c: Set 'GCC_COLORS' to the empty string.
---
 libgomp/testsuite/libgomp.c/reverse-offload-sm30.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c/reverse-offload-sm30.c b/libgomp/testsuite/libgomp.c/reverse-offload-sm30.c
index 7f10fd4ded9..cae75f03462 100644
--- a/libgomp/testsuite/libgomp.c/reverse-offload-sm30.c
+++ b/libgomp/testsuite/libgomp.c/reverse-offload-sm30.c
@@ -12,4 +12,7 @@ main ()
   return 0;
 }
 
+/* The 'mkoffload's currently don't obey '-fno-diagnostics-color' etc., so use a different way to effect the same thing:
+   { dg-set-compiler-env-var GCC_COLORS "" }
+   ..., so that the following regexp doesn't have to deal with color code escape sequences.  */
 /* { dg-warning "'omp requires reverse_offload' requires at least 'sm_35' for '-foffload-options=nvptx-none=-march=' - disabling offload-code generation for this device type" "" { target *-*-* } 0 } */
-- 
2.34.1


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 12:06 [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl Tobias Burnus
2024-04-04 19:17 ` Thomas Schwinge
2024-04-05 12:17 ` nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl: Restore 'libgomp.c/reverse-offload-sm30.c' testing (was: [Patch] nvptx: In mkoffload.cc, call diagnostic_color_init + gcc_init_libintl) Thomas Schwinge

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