Hi! On Mon, Jan 29, 2018 at 02:33:50PM -0600, Peter Bergner wrote: > On 1/29/18 1:23 PM, Segher Boessenkool wrote: > >> +#ifdef __linux__ > >> +/* Canonical GCC cpu name table. */ > >> +static const char *rs6000_supported_cpu_names[] = > >> +{ > >> +#define RS6000_CPU(NAME, CPU, FLAGS) NAME, > >> +#include "rs6000-cpus.def" > >> +#undef RS6000_CPU > >> +}; > > > > Can't you just use processor_target_table here? Seems like a waste to > > duplicate all that. (Need to make the table non-static then of course). > > Changing it to static won't help, because we don't link rs6000.o into > xgcc. That file is linked into cc1, etc, so we don't have access to it.
Oh ah, tricky. Fine as is then. > Well, this isn't fprintf that I can call multiple times to emit my entire > error message. Once you call fatal_error(), it never returns, so I copied > the way opts-common.c:cmdline_handle_error() emits its error message which > is to build it up and then emit it altogether like this....however, I now > see I copied GCC 5's version of this code. Doh! :-) > > The current version of that code looks like the following, which I should > copy instead. Unless you have a different suggestion? Looks better yeah :-) Probably candidates_list_and_hint does similar nasty character counting, but we don't have to look at it ;-) Segher > char *s; > > if (e->unknown_error) > error_at (loc, e->unknown_error, arg); > else > error_at (loc, "unrecognized argument in option %qs", opt); > > auto_vec <const char *> candidates; > for (i = 0; e->values[i].arg != NULL; i++) > { > if (!enum_arg_ok_for_language (&e->values[i], lang_mask)) > continue; > candidates.safe_push (e->values[i].arg); > } > const char *hint = candidates_list_and_hint (arg, s, candidates); > if (hint) > inform (loc, "valid arguments to %qs are: %s; did you mean %qs?", > option->opt_text, s, hint); > else > inform (loc, "valid arguments to %qs are: %s", option->opt_text, s); > XDELETEVEC (s);