public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722]
@ 2022-11-23  8:51 Jakub Jelinek
  2022-11-23 13:20 ` David Malcolm
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2022-11-23  8:51 UTC (permalink / raw)
  To: David Malcolm; +Cc: gcc-patches

Hi!

As reported in the PR, since special_fname_builtin () call has been
introduced, the diagnostics code compares filename against _("<built-in>")
rather than "<built-in>", which means that if self tests are performed
with the string being translated, one self-test fails.
The following patch fixes that.

Bootstrapped/regtested on x86_64-linux and i686-linux (with normal C locale)
and by the reporter in German, where it fixes the problem.  Ok for trunk?

2022-11-22  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/107722
	* diagnostic.cc (test_diagnostic_get_location_text): Test
	special_fname_builtin () rather than "<built-in>" and expect
	special_fname_builtin () concatenated with ":" for it.

--- gcc/diagnostic.cc.jj	2022-11-15 22:57:18.215211107 +0100
+++ gcc/diagnostic.cc	2022-11-22 12:36:37.197764164 +0100
@@ -2593,7 +2593,10 @@ test_diagnostic_get_location_text ()
   const char *old_progname = progname;
   progname = "PROGNAME";
   assert_location_text ("PROGNAME:", NULL, 0, 0, true);
-  assert_location_text ("<built-in>:", "<built-in>", 42, 10, true);
+  char *built_in_colon = concat (special_fname_builtin (), ":", (char *) 0);
+  assert_location_text (built_in_colon, special_fname_builtin (),
+			42, 10, true);
+  free (built_in_colon);
   assert_location_text ("foo.c:42:10:", "foo.c", 42, 10, true);
   assert_location_text ("foo.c:42:9:", "foo.c", 42, 10, true, 0);
   assert_location_text ("foo.c:42:1010:", "foo.c", 42, 10, true, 1001);

	Jakub


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

* Re: [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722]
  2022-11-23  8:51 [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722] Jakub Jelinek
@ 2022-11-23 13:20 ` David Malcolm
  0 siblings, 0 replies; 2+ messages in thread
From: David Malcolm @ 2022-11-23 13:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 2022-11-23 at 09:51 +0100, Jakub Jelinek wrote:
> Hi!
> 
> As reported in the PR, since special_fname_builtin () call has been
> introduced, the diagnostics code compares filename against _("<built-
> in>")
> rather than "<built-in>", which means that if self tests are
> performed
> with the string being translated, one self-test fails.
> The following patch fixes that.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux (with normal C
> locale)
> and by the reporter in German, where it fixes the problem.  Ok for
> trunk?

OK

Thanks
Dave


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

end of thread, other threads:[~2022-11-23 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23  8:51 [PATCH] diagnostics: Fix selftest ICE in certain locales [PR107722] Jakub Jelinek
2022-11-23 13:20 ` David Malcolm

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