]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix gcc-urlifier selftest failure
authorSandra Loosemore <sloosemore@baylibre.com>
Sun, 25 Jan 2026 22:43:58 +0000 (22:43 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Sun, 25 Jan 2026 23:24:14 +0000 (23:24 +0000)
My recent commits for PR122243 added index entries for -fno-* options
as well as their normal positive forms.  Apparently the "urlifier"
used to insert option URLS into diagnostic messages can find the
anchor for either form, but its self-tests are hard-wired to match
only the positive form for the two specific options it's looking up.
This patch robustifies it to allow it to match the anchor for either
the positive or negative forms.

gcc/ChangeLog
* gcc-urlifier.cc (test_gcc_urlifier): Match either positive
or negative option URLS.

gcc/gcc-urlifier.cc

index d6958e3f6f8633a2d4c11544896e78b57032209b..37f87d55a915ce12067f00e1c7f03d77d7ab9dae 100644 (file)
@@ -262,12 +262,18 @@ test_gcc_urlifier ()
        doc_urls[idx].url_suffix);
 
   /* Check an option.  */
-  ASSERT_STREQ (u.get_url_suffix_for_quoted_text ("-fpack-struct").get (),
-               "gcc/Code-Gen-Options.html#index-fpack-struct");
+  const char *s1 = u.get_url_suffix_for_quoted_text ("-fpack-struct").get ();
+  ASSERT_TRUE (!strcmp (s1,
+                       "gcc/Code-Gen-Options.html#index-fno-pack-struct")
+              || !strcmp (s1,
+                          "gcc/Code-Gen-Options.html#index-fpack-struct"));
 
   /* Check a "-fno-" variant of an option.  */
-  ASSERT_STREQ (u.get_url_suffix_for_quoted_text ("-fno-inline").get (),
-               "gcc/Optimize-Options.html#index-finline");
+  const char *s2 = u.get_url_suffix_for_quoted_text ("-fno-inline").get ();
+  ASSERT_TRUE (!strcmp (s2,
+                       "gcc/Optimize-Options.html#index-fno-inline")
+              || !strcmp (s2,
+                          "gcc/Optimize-Options.html#index-finline"));
 }
 
 /* Run all of the selftests within this file.  */