On Thu, Nov 22, 2018 at 2:51 PM Uros Bizjak <ubiz...@gmail.com> 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 <mli...@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. */ Typo above. > +STATIC_ASSERT ((sizeof (processor_names) / sizeof (processor_names[0]) > + == PROCESSOR_max)); > > Please use ARRAY_SIZE macro here. BTW: There is another similar table in i386.c, processor_cost_table. Can we add STATIC_ASSERT for this table, too? Uros.