Message ID | 81ae4340-d3bd-0796-949c-2b3887521752@suse.cz |
---|---|
State | New |
Headers | show |
Series | Provide proper error message for -flto=abcd. | expand |
On 7/29/19 7:36 AM, Martin Liška wrote: > Hi. > > The patch is about proper error message for situations where > user give a wrong argument to -flto option. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > > gcc/ChangeLog: > > 2019-07-29 Martin Liska <mliska@suse.cz> > > * opts.c (common_handle_option): Error for an invalid argument > to -flto=. > > gcc/testsuite/ChangeLog: > > 2019-07-29 Martin Liska <mliska@suse.cz> > > * gcc.dg/spellcheck-options-21.c: New test. OK, including any minor adjustments to deal with any changes in the -flto option made since this was originally submitted. jeff
diff --git a/gcc/opts.c b/gcc/opts.c index 296f0f61802..3639edf4cd7 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2821,6 +2821,14 @@ common_handle_option (struct gcc_options *opts, opts->x_flag_lto = value ? "" : NULL; break; + case OPT_flto_: + if (strcmp (arg, "none") != 0 + && strcmp (arg, "jobserver") != 0 + && atoi (arg) == 0) + error_at (loc, + "unrecognized argument to %<-flto=%> option: %qs", arg); + break; + case OPT_w: dc->dc_inhibit_warnings = true; break; diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-21.c b/gcc/testsuite/gcc.dg/spellcheck-options-21.c new file mode 100644 index 00000000000..3e0e8a8ebaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/spellcheck-options-21.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-flto=sparta" } */ +/* { dg-error "unrecognized argument to '-flto=' option: 'sparta'" "" { target *-*-* } 0 } */