Provide proper error message for -flto=abcd.
authorMartin Liska <mliska@suse.cz>
Fri, 9 Aug 2019 07:51:40 +0000 (09:51 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 9 Aug 2019 07:51:40 +0000 (07:51 +0000)
2019-08-09  Martin Liska  <mliska@suse.cz>

* opts.c (common_handle_option): Error for an invalid argument
to -flto=.
2019-08-09  Martin Liska  <mliska@suse.cz>

* gcc.dg/spellcheck-options-21.c: New test.

From-SVN: r274231

gcc/ChangeLog
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/spellcheck-options-21.c [new file with mode: 0644]

index 21652c8..50a2b8f 100644 (file)
@@ -1,5 +1,10 @@
 2019-08-09  Martin Liska  <mliska@suse.cz>
 
+       * opts.c (common_handle_option): Error for an invalid argument
+       to -flto=.
+
+2019-08-09  Martin Liska  <mliska@suse.cz>
+
        * ipa-icf.c (sem_function::merge): Define AUTO_DUMP_SCOPE and
        use dump_printf to report optimization.
        (sem_variable::merge): Likwise.
index 28142ce..a0a7789 100644 (file)
@@ -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;
index 73022f3..317b7e5 100644 (file)
@@ -1,5 +1,9 @@
 2019-08-09  Martin Liska  <mliska@suse.cz>
 
+       * gcc.dg/spellcheck-options-21.c: New test.
+
+2019-08-09  Martin Liska  <mliska@suse.cz>
+
        * 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 (file)
index 0000000..3e0e8a8
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-flto=sparta" } */
+/* { dg-error "unrecognized argument to '-flto=' option: 'sparta'" "" { target *-*-* } 0 } */