It seems odd that we add "native" to the list for -march but not for -mcpu. This is probably a bug, but for now we'll preserve the existing behaviour.
gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_print_hint_for_core_or_arch): Inline into... (aarch64_print_hint_for_core): ...here... (aarch64_print_hint_for_arch): ...and here. diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 9b44d08f3e5fe6b4a7aa8f040e7001e3070b362d..f33034cbb205eb52b5ee5965b8b972cedf6f4927 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -18884,25 +18884,17 @@ aarch64_override_options_internal (struct gcc_options *opts) aarch64_override_options_after_change_1 (opts); } -/* Print a hint with a suggestion for a core or architecture name that - most closely resembles what the user passed in STR. ARCH is true if - the user is asking for an architecture name. ARCH is false if the user - is asking for a core name. */ +/* Print a hint with a suggestion for a core name that most closely resembles + what the user passed in STR. */ -static void -aarch64_print_hint_for_core_or_arch (const char *str, bool arch) +inline static void +aarch64_print_hint_for_core (const char *str) { auto_vec<const char *> candidates; - const struct processor *entry = arch ? all_architectures : all_cores; + const struct processor *entry = all_cores; for (; entry->name != NULL; entry++) candidates.safe_push (entry->name); -#ifdef HAVE_LOCAL_CPU_DETECT - /* Add also "native" as possible value. */ - if (arch) - candidates.safe_push ("native"); -#endif - char *s; const char *hint = candidates_list_and_hint (str, s, candidates); if (hint) @@ -18914,22 +18906,31 @@ aarch64_print_hint_for_core_or_arch (const char *str, bool arch) XDELETEVEC (s); } -/* Print a hint with a suggestion for a core name that most closely resembles - what the user passed in STR. */ - -inline static void -aarch64_print_hint_for_core (const char *str) -{ - aarch64_print_hint_for_core_or_arch (str, false); -} - /* Print a hint with a suggestion for an architecture name that most closely resembles what the user passed in STR. */ inline static void aarch64_print_hint_for_arch (const char *str) { - aarch64_print_hint_for_core_or_arch (str, true); + auto_vec<const char *> candidates; + const struct processor *entry = all_architectures; + for (; entry->name != NULL; entry++) + candidates.safe_push (entry->name); + +#ifdef HAVE_LOCAL_CPU_DETECT + /* Add also "native" as possible value. */ + candidates.safe_push ("native"); +#endif + + char *s; + const char *hint = candidates_list_and_hint (str, s, candidates); + if (hint) + inform (input_location, "valid arguments are: %s;" + " did you mean %qs?", s, hint); + else + inform (input_location, "valid arguments are: %s", s); + + XDELETEVEC (s); }