From 40077d15a87e7fe707b7282ab6f241737d2b3b18 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 9 Aug 2019 09:51:40 +0200 Subject: [PATCH] Provide proper error message for -flto=abcd. 2019-08-09 Martin Liska * opts.c (common_handle_option): Error for an invalid argument to -flto=. 2019-08-09 Martin Liska * gcc.dg/spellcheck-options-21.c: New test. From-SVN: r274231 --- gcc/ChangeLog | 5 +++++ gcc/opts.c | 8 ++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/spellcheck-options-21.c | 3 +++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/spellcheck-options-21.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 21652c8..50a2b8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2019-08-09 Martin Liska + * opts.c (common_handle_option): Error for an invalid argument + to -flto=. + +2019-08-09 Martin Liska + * ipa-icf.c (sem_function::merge): Define AUTO_DUMP_SCOPE and use dump_printf to report optimization. (sem_variable::merge): Likwise. diff --git a/gcc/opts.c b/gcc/opts.c index 28142ce..a0a7789 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2822,6 +2822,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/ChangeLog b/gcc/testsuite/ChangeLog index 73022f3..317b7e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2019-08-09 Martin Liska + * gcc.dg/spellcheck-options-21.c: New test. + +2019-08-09 Martin Liska + * g++.dg/ipa/ipa-icf-2.C: Add -optimized to -fdump-ipa-icf. * g++.dg/ipa/ipa-icf-3.C: Likewise. * g++.dg/ipa/ipa-icf-4.C: Likewise. 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 0000000..3e0e8a8 --- /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 } */ -- 2.7.4