diff gcc/opts-global.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/opts-global.c	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/opts-global.c	Thu Feb 13 11:34:05 2020 +0900
@@ -1,6 +1,6 @@
 /* Command line option handling.  Code involving global state that
    should not be shared with the driver.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -99,14 +99,18 @@
     bad_lang = write_langs (lang_mask);
 
   if (opt_flags == CL_DRIVER)
-    error ("command line option %qs is valid for the driver but not for %s",
+    error ("command-line option %qs is valid for the driver but not for %s",
 	   text, bad_lang);
   else if (lang_mask == CL_DRIVER)
     gcc_unreachable ();
-  else
+  else if (ok_langs[0] != '\0')
     /* Eventually this should become a hard error IMO.  */
-    warning (0, "command line option %qs is valid for %s but not for %s",
+    warning (0, "command-line option %qs is valid for %s but not for %s",
 	     text, ok_langs, bad_lang);
+  else
+    /* Happens for -Werror=warning_name.  */
+    warning (0, "%<-Werror=%> argument %qs is not valid for %s",
+	     text, bad_lang);
 
   free (ok_langs);
   free (bad_lang);
@@ -136,7 +140,7 @@
 
       opt = ignored_options.pop ();
       warning_at (UNKNOWN_LOCATION, 0,
-		  "unrecognized command line option %qs", opt);
+		  "unrecognized command-line option %qs", opt);
     }
 }
 
@@ -251,6 +255,7 @@
      construct their pretty-printers means that all previous settings
      are overriden.  */
   diagnostic_color_init (global_dc);
+  diagnostic_urls_init (global_dc);
 }
 
 /* Decode command-line options to an array, like
@@ -315,6 +320,13 @@
 			&handlers, dc);
 
   finish_options (opts, opts_set, loc);
+
+  /* Print --help=* if used.  */
+  unsigned i;
+  const char *arg;
+
+  FOR_EACH_VEC_ELT (help_option_arguments, i, arg)
+    print_help (opts, lang_mask, arg);
 }
 
 /* Hold command-line options associated with stack limitation.  */
@@ -372,12 +384,12 @@
 
 	case OPT_fdump_:
 	  if (!g->get_dumps ()->dump_switch_p (opt->arg))
-	    error ("unrecognized command line option %<-fdump-%s%>", opt->arg);
+	    error ("unrecognized command-line option %<-fdump-%s%>", opt->arg);
 	  break;
 
         case OPT_fopt_info_:
 	  if (!opt_info_switch_p (opt->arg))
-	    error ("unrecognized command line option %<-fopt-info-%s%>",
+	    error ("unrecognized command-line option %<-fopt-info-%s%>",
                    opt->arg);
           break;
 
@@ -448,8 +460,8 @@
 
 	case OPT_fasan_shadow_offset_:
 	  if (!(flag_sanitize & SANITIZE_KERNEL_ADDRESS))
-	    error ("-fasan-shadow-offset should only be used "
-		   "with -fsanitize=kernel-address");
+	    error ("%<-fasan-shadow-offset%> should only be used "
+		   "with %<-fsanitize=kernel-address%>");
 	  if (!set_asan_shadow_offset (opt->arg))
 	     error ("unrecognized shadow offset %qs", opt->arg);
 	  break;