This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix option values for -march.


On Thu, Nov 22, 2018 at 2:43 PM Martin Liška <mliska@suse.cz> wrote:

> The patch makes clear we'll not diverge number of elements in
> processor_names and the corresponding enum. Plus I fixed
> -march=znver2 native as valid options that were not listed.
>
> Patch survives tests and bootstrap on x86_64-linux-gnu.
>
> Ready for trunk?
> Martin
>
> gcc/ChangeLog:
>
> 2018-11-22  Martin Liska  <mliska@suse.cz>
>
>         * common/config/i386/i386-common.c (processor_names): Add
>         static assert and add missing "znver2".
>         (ix86_get_valid_option_values): Add checking assert for null
>         values and add "native" value if feasible.
>         * config/i386/i386.h: Do not declare size of processor_names.
> ---
>  gcc/common/config/i386/i386-common.c | 26 ++++++++++++++++++++++----
>  gcc/config/i386/i386.h               |  2 +-
>  2 files changed, 23 insertions(+), 5 deletions(-)

+/* Guarantee that the array is aligned with henum processor_type.  */
+STATIC_ASSERT ((sizeof (processor_names) / sizeof (processor_names[0])
+ == PROCESSOR_max));

Please use ARRAY_SIZE macro here.

+#ifdef HAVE_LOCAL_CPU_DETECT
+      /* Add also "native" as possible value.  */
+      v.safe_push ("native");
+#endif

"native" is processed by the driver and this option is never passed to cc1.

Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]