https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115440

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix:
--- gcc/opts-common.cc.jj       2024-05-21 10:19:35.694512065 +0200
+++ gcc/opts-common.cc  2024-06-11 23:10:43.428656210 +0200
@@ -524,6 +524,7 @@ add_misspelling_candidates (auto_vec<cha
   for (unsigned i = 0; i < ARRAY_SIZE (option_map); i++)
     {
       const char *opt0 = option_map[i].opt0;
+      const char *opt1 = option_map[i].opt1;
       const char *new_prefix = option_map[i].new_prefix;
       size_t new_prefix_len = strlen (new_prefix);

@@ -532,8 +533,9 @@ add_misspelling_candidates (auto_vec<cha

       if (strncmp (opt_text, new_prefix, new_prefix_len) == 0)
        {
-         char *alternative = concat (opt0 + 1, opt_text + new_prefix_len,
-                                     NULL);
+         char *alternative
+           = concat (opt0 + 1, opt1 ? " " : "", opt1 ? opt1 : "",
+                     opt_text + new_prefix_len, NULL);
          candidates->safe_push (alternative);
        }
     }
In my limited understanding, if opt1 is non-NULL in option_map, so the
    { "--machine", "", "-m", false, false },
    { "--machine", "no-", "-m", false, true },
...
    { "--std", "", "-std=", false, false },
entries, I think that is about mapping --machine foobar to -mfoobar or
--machine no-foobar to -mfoobar or --std foobar to -std=foobar
We do accept --std c++17 with the same meaning as -std=c++17 but just don't add
the space in between because opt1 is for the case where the option is present
as two separate options.

Reply via email to