aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2024-05-08 11:25:57 +0800
committerXi Ruoyao <xry111@xry111.site>2024-05-10 11:20:21 +0800
commitf75806ec63ec1af2d76a194e5fa73e114b2b8857 (patch)
tree14ad90a739a9274f9a97f7bed7c99d766c633060 /gcc
parentbfb88b1406cdd8d3f97e280b0d63529aa925f18a (diff)
downloadgcc-f75806ec63ec1af2d76a194e5fa73e114b2b8857.zip
gcc-f75806ec63ec1af2d76a194e5fa73e114b2b8857.tar.gz
gcc-f75806ec63ec1af2d76a194e5fa73e114b2b8857.tar.bz2
driver: Move -fdiagnostics-urls= early like -fdiagnostics-color= [PR114980]
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=.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/opts-common.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 4a2dff2..2d1e86f 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);
}