public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980]
@ 2024-05-08  5:50 Xi Ruoyao
  2024-05-09 20:21 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Ruoyao @ 2024-05-08  5:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, David Malcolm, Xi Ruoyao

In GCC 14 we started to emit URLs for "command-line option <option> is
valid for <language> but not <another language>" and "-Werror= argument
'-Werror=<option>' is not valid for <language>" warnings.  So we should
have moved -fdiagnostics-urls= early like -fdiagnostics-color=, or
-fdiagnostics-urls= wouldn't be able to control URLs in these warnings.

No test cases are added because with TERM=xterm-256colors PR114980
already triggers some test failures.

gcc/ChangeLog:

	PR driver/114980
	* opts-common.cc (prune_options): Move -fdiagnostics-urls=
	early like -fdiagnostics-color=.
---

Bootstrapped and regtested on x86_64-linux-gnu.  Ok for trunk and
releases/gcc-14?

 gcc/opts-common.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 4a2dff243b0..2d1e86ff94f 100644
--- a/gcc/opts-common.cc
+++ b/gcc/opts-common.cc
@@ -1152,6 +1152,7 @@ prune_options (struct cl_decoded_option **decoded_options,
   unsigned int options_to_prepend = 0;
   unsigned int Wcomplain_wrong_lang_idx = 0;
   unsigned int fdiagnostics_color_idx = 0;
+  unsigned int fdiagnostics_urls_idx = 0;
 
   /* Remove arguments which are negated by others after them.  */
   new_decoded_options_count = 0;
@@ -1185,6 +1186,12 @@ prune_options (struct cl_decoded_option **decoded_options,
 	    ++options_to_prepend;
 	  fdiagnostics_color_idx = i;
 	  continue;
+	case OPT_fdiagnostics_urls_:
+	  gcc_checking_assert (i != 0);
+	  if (fdiagnostics_urls_idx == 0)
+	    ++options_to_prepend;
+	  fdiagnostics_urls_idx = i;
+	  continue;
 
 	default:
 	  gcc_assert (opt_idx < cl_options_count);
@@ -1248,6 +1255,12 @@ keep:
 	    = old_decoded_options[fdiagnostics_color_idx];
 	  new_decoded_options_count++;
 	}
+      if (fdiagnostics_urls_idx != 0)
+	{
+	  new_decoded_options[argv_0 + options_prepended++]
+	    = old_decoded_options[fdiagnostics_urls_idx];
+	  new_decoded_options_count++;
+	}
       gcc_checking_assert (options_to_prepend == options_prepended);
     }
 
-- 
2.45.0


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

* Re: [PATCH] driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980]
  2024-05-08  5:50 [PATCH] driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980] Xi Ruoyao
@ 2024-05-09 20:21 ` Joseph Myers
  2024-05-10  3:29   ` Pushed: " Xi Ruoyao
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2024-05-09 20:21 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: gcc-patches, Jakub Jelinek, David Malcolm

On Wed, 8 May 2024, Xi Ruoyao wrote:

> In GCC 14 we started to emit URLs for "command-line option <option> is
> valid for <language> but not <another language>" and "-Werror= argument
> '-Werror=<option>' is not valid for <language>" warnings.  So we should
> have moved -fdiagnostics-urls= early like -fdiagnostics-color=, or
> -fdiagnostics-urls= wouldn't be able to control URLs in these warnings.
> 
> No test cases are added because with TERM=xterm-256colors PR114980
> already triggers some test failures.
> 
> gcc/ChangeLog:
> 
> 	PR driver/114980
> 	* opts-common.cc (prune_options): Move -fdiagnostics-urls=
> 	early like -fdiagnostics-color=.

OK.

-- 
Joseph S. Myers
josmyers@redhat.com


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

* Pushed: [PATCH] driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980]
  2024-05-09 20:21 ` Joseph Myers
@ 2024-05-10  3:29   ` Xi Ruoyao
  0 siblings, 0 replies; 3+ messages in thread
From: Xi Ruoyao @ 2024-05-10  3:29 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches, Jakub Jelinek, David Malcolm

On Thu, 2024-05-09 at 20:21 +0000, Joseph Myers wrote:
> On Wed, 8 May 2024, Xi Ruoyao wrote:
> 
> > In GCC 14 we started to emit URLs for "command-line option <option> is
> > valid for <language> but not <another language>" and "-Werror= argument
> > '-Werror=<option>' is not valid for <language>" warnings.  So we should
> > have moved -fdiagnostics-urls= early like -fdiagnostics-color=, or
> > -fdiagnostics-urls= wouldn't be able to control URLs in these warnings.
> > 
> > No test cases are added because with TERM=xterm-256colors PR114980
> > already triggers some test failures.
> > 
> > gcc/ChangeLog:
> > 
> > 	PR driver/114980
> > 	* opts-common.cc (prune_options): Move -fdiagnostics-urls=
> > 	early like -fdiagnostics-color=.
> 
> OK.

Pushed r15-355 and r14-10192.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

end of thread, other threads:[~2024-05-10  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08  5:50 [PATCH] driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980] Xi Ruoyao
2024-05-09 20:21 ` Joseph Myers
2024-05-10  3:29   ` Pushed: " Xi Ruoyao

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