Index: gcc/opts-common.c
===================================================================
--- gcc/opts-common.c	(revision 166610)
+++ gcc/opts-common.c	(working copy)
@@ -722,17 +722,19 @@ keep:
 /* Handle option DECODED for the language indicated by LANG_MASK,
    using the handlers in HANDLERS and setting fields in OPTS and
    OPTS_SET.  KIND is the diagnostic_t if this is a diagnostics
-   option, DK_UNSPECIFIED otherwise.  GENERATED_P is true for an
-   option generated as part of processing another option or otherwise
-   generated internally, false for one explicitly passed by the user.
-   Returns false if the switch was invalid.  DC is the diagnostic
-   context for options affecting diagnostics state, or NULL.  */
+   option, DK_UNSPECIFIED otherwise, and LOC is the location of the
+   option for options from the source file, UNKNOWN_LOCATION
+   otherwise.  GENERATED_P is true for an option generated as part of
+   processing another option or otherwise generated internally, false
+   for one explicitly passed by the user.  Returns false if the switch
+   was invalid.  DC is the diagnostic context for options affecting
+   diagnostics state, or NULL.  */
 
-bool
+static bool
 handle_option (struct gcc_options *opts,
 	       struct gcc_options *opts_set,
 	       const struct cl_decoded_option *decoded,
-	       unsigned int lang_mask, int kind,
+	       unsigned int lang_mask, int kind, location_t loc,
 	       const struct cl_option_handlers *handlers,
 	       bool generated_p, diagnostic_context *dc)
 {
@@ -745,13 +747,14 @@ handle_option (struct gcc_options *opts,
 
   if (flag_var)
     set_option (opts, (generated_p ? NULL : opts_set),
-		opt_index, value, arg, kind, dc);
+		opt_index, value, arg, kind, loc, dc);
 
   for (i = 0; i < handlers->num_handlers; i++)
     if (option->flags & handlers->handlers[i].mask)
       {
 	if (!handlers->handlers[i].handler (opts, opts_set, decoded,
-					    lang_mask, kind, handlers, dc))
+					    lang_mask, kind, loc,
+					    handlers, dc))
 	  return false;
 	else
 	  handlers->post_handling_callback (decoded,
@@ -770,15 +773,15 @@ bool
 handle_generated_option (struct gcc_options *opts,
 			 struct gcc_options *opts_set,
 			 size_t opt_index, const char *arg, int value,
-			 unsigned int lang_mask, int kind,
+			 unsigned int lang_mask, int kind, location_t loc,
 			 const struct cl_option_handlers *handlers,
 			 diagnostic_context *dc)
 {
   struct cl_decoded_option decoded;
 
   generate_option (opt_index, arg, value, lang_mask, &decoded);
-  return handle_option (opts, opts_set, &decoded, lang_mask, kind, handlers,
-			true, dc);
+  return handle_option (opts, opts_set, &decoded, lang_mask, kind, loc,
+			handlers, true, dc);
 }
 
 /* Fill in *DECODED with an option described by OPT_INDEX, ARG and
@@ -836,15 +839,16 @@ generate_option_input_file (const char *
   decoded->errors = 0;
 }
 
-/* Handle the switch DECODED for the language indicated by LANG_MASK,
-   using the handlers in *HANDLERS and setting fields in OPTS and
-   OPTS_SET and using diagnostic context DC (if not NULL) for
+/* Handle the switch DECODED (location LOC) for the language indicated
+   by LANG_MASK, using the handlers in *HANDLERS and setting fields in
+   OPTS and OPTS_SET and using diagnostic context DC (if not NULL) for
    diagnostic options.  */
 
 void
 read_cmdline_option (struct gcc_options *opts,
 		     struct gcc_options *opts_set,
 		     struct cl_decoded_option *decoded,
+		     location_t loc,
 		     unsigned int lang_mask,
 		     const struct cl_option_handlers *handlers,
 		     diagnostic_context *dc)
@@ -853,12 +857,12 @@ read_cmdline_option (struct gcc_options 
   const char *opt = decoded->orig_option_with_args_text;
 
   if (decoded->warn_message)
-    warning (0, decoded->warn_message, opt);
+    warning_at (loc, 0, decoded->warn_message, opt);
 
   if (decoded->opt_index == OPT_SPECIAL_unknown)
     {
       if (handlers->unknown_option_callback (decoded))
-	error ("unrecognized command line option %qs", decoded->arg);
+	error_at (loc, "unrecognized command line option %qs", decoded->arg);
       return;
     }
 
@@ -869,8 +873,8 @@ read_cmdline_option (struct gcc_options 
 
   if (decoded->errors & CL_ERR_DISABLED)
     {
-      error ("command line option %qs"
-	     " is not supported by this configuration", opt);
+      error_at (loc, "command line option %qs"
+		" is not supported by this configuration", opt);
       return;
     }
 
@@ -883,35 +887,35 @@ read_cmdline_option (struct gcc_options 
   if (decoded->errors & CL_ERR_MISSING_ARG)
     {
       if (option->missing_argument_error)
-	error (option->missing_argument_error, opt);
+	error_at (loc, option->missing_argument_error, opt);
       else
-	error ("missing argument to %qs", opt);
+	error_at (loc, "missing argument to %qs", opt);
       return;
     }
 
   if (decoded->errors & CL_ERR_UINT_ARG)
     {
-      error ("argument to %qs should be a non-negative integer",
-	     option->opt_text);
+      error_at (loc, "argument to %qs should be a non-negative integer",
+		option->opt_text);
       return;
     }
 
   gcc_assert (!decoded->errors);
 
   if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED,
-		      handlers, false, dc))
-    error ("unrecognized command line option %qs", opt);
+		      loc, handlers, false, dc))
+    error_at (loc, "unrecognized command line option %qs", opt);
 }
 
 /* Set any field in OPTS, and OPTS_SET if not NULL, for option
-   OPT_INDEX according to VALUE and ARG, diagnostic kind KIND, using
-   diagnostic context DC if not NULL for diagnostic
-   classification.  */
+   OPT_INDEX according to VALUE and ARG, diagnostic kind KIND,
+   location LOC, using diagnostic context DC if not NULL for
+   diagnostic classification.  */
 
 void
 set_option (struct gcc_options *opts, struct gcc_options *opts_set,
 	    int opt_index, int value, const char *arg, int kind,
-	    diagnostic_context *dc)
+	    location_t loc, diagnostic_context *dc)
 {
   const struct cl_option *option = &cl_options[opt_index];
   void *flag_var = option_flag_var (opt_index, opts);
@@ -958,8 +962,7 @@ set_option (struct gcc_options *opts, st
 
   if ((diagnostic_t) kind != DK_UNSPECIFIED
       && dc != NULL)
-    diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind,
-				    UNKNOWN_LOCATION);
+    diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc);
 }
 
 /* Return the address of the flag variable for option OPT_INDEX in
Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 166610)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -241,7 +241,8 @@ c_common_init_options (unsigned int deco
    invalid, true if valid.  Use HANDLERS in recursive handle_option calls.  */
 bool
 c_common_handle_option (size_t scode, const char *arg, int value,
-			int kind, const struct cl_option_handlers *handlers)
+			int kind, location_t loc,
+			const struct cl_option_handlers *handlers)
 {
   const struct cl_option *option = &cl_options[scode];
   enum opt_code code = (enum opt_code) scode;
@@ -357,7 +358,8 @@ c_common_handle_option (size_t scode, co
       set_Wformat (value);
       handle_generated_option (&global_options, &global_options_set,
 			       OPT_Wimplicit, NULL, value,
-			       c_family_lang_mask, kind, handlers, global_dc);
+			       c_family_lang_mask, kind, loc,
+			       handlers, global_dc);
       warn_char_subscripts = value;
       warn_missing_braces = value;
       warn_parentheses = value;
@@ -452,13 +454,13 @@ c_common_handle_option (size_t scode, co
       if (warn_implicit_int == -1)
 	handle_generated_option (&global_options, &global_options_set,
 				 OPT_Wimplicit_int, NULL, value,
-				 c_family_lang_mask, kind, handlers,
+				 c_family_lang_mask, kind, loc, handlers,
 				 global_dc);
       if (warn_implicit_function_declaration == -1)
 	handle_generated_option (&global_options, &global_options_set,
 				 OPT_Wimplicit_function_declaration, NULL,
-				 value, c_family_lang_mask, kind, handlers,
-				 global_dc);
+				 value, c_family_lang_mask, kind, loc,
+				 handlers, global_dc);
       break;
 
     case OPT_Winvalid_pch:
Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 166610)
+++ gcc/c-family/c-common.c	(working copy)
@@ -7804,7 +7804,8 @@ parse_optimize_options (tree args, bool 
 						&decoded_options,
 						&decoded_options_count);
   decode_options (&global_options, &global_options_set,
-		  decoded_options, decoded_options_count, global_dc);
+		  decoded_options, decoded_options_count,
+		  input_location, global_dc);
 
   targetm.override_options_after_change();
 
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h	(revision 166610)
+++ gcc/c-family/c-common.h	(working copy)
@@ -696,7 +696,7 @@ extern void set_Wformat (int);
 extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
 extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
 extern bool attribute_takes_identifier_p (const_tree);
-extern bool c_common_handle_option (size_t, const char *, int, int,
+extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
 				    const struct cl_option_handlers *);
 extern tree c_common_type_for_mode (enum machine_mode, int);
 extern tree c_common_type_for_size (unsigned int, int);
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in	(revision 166610)
+++ gcc/java/Make-lang.in	(working copy)
@@ -57,7 +57,7 @@ JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-
 .PHONY: java
 
 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h opts.h
+  $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
 	(SHLIB_LINK='$(SHLIB_LINK)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
@@ -302,7 +302,7 @@ java/jvgenmain.o: java/jvgenmain.c $(CON
   coretypes.h $(TM_H) intl.h
 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
   toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \
-  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h $(OPTIONS_H) \
+  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h $(OPTS_H) $(OPTIONS_H) \
   $(TARGET_H)
 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
   coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
Index: gcc/java/lang.c
===================================================================
--- gcc/java/lang.c	(revision 166610)
+++ gcc/java/lang.c	(working copy)
@@ -52,7 +52,7 @@ static void java_init_options_struct (st
 static void java_init_options (unsigned int, struct cl_decoded_option *);
 static bool java_post_options (const char **);
 
-static bool java_handle_option (size_t, const char *, int, int,
+static bool java_handle_option (size_t, const char *, int, int, location_t,
 				const struct cl_option_handlers *);
 static void put_decl_string (const char *, int);
 static void put_decl_node (tree, int);
@@ -183,7 +183,7 @@ struct lang_hooks lang_hooks = LANG_HOOK
  */
 static bool
 java_handle_option (size_t scode, const char *arg, int value,
-		    int kind ATTRIBUTE_UNUSED,
+		    int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED,
 		    const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
 {
   enum opt_code code = (enum opt_code) scode;
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 166610)
+++ gcc/gcc.c	(working copy)
@@ -3141,6 +3141,7 @@ driver_handle_option (struct gcc_options
 		      struct gcc_options *opts_set,
 		      const struct cl_decoded_option *decoded,
 		      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
+		      location_t loc,
 		      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
 		      diagnostic_context *dc)
 {
@@ -3154,6 +3155,7 @@ driver_handle_option (struct gcc_options
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set == &global_options_set);
   gcc_assert (kind == DK_UNSPECIFIED);
+  gcc_assert (loc == UNKNOWN_LOCATION);
   gcc_assert (dc == global_dc);
 
   switch (opt_index)
@@ -3799,8 +3801,8 @@ process_command (unsigned int decoded_op
 	}
 
       read_cmdline_option (&global_options, &global_options_set,
-			   decoded_options + j, CL_DRIVER, &handlers,
-			   global_dc);
+			   decoded_options + j, UNKNOWN_LOCATION,
+			   CL_DRIVER, &handlers, global_dc);
     }
 
   /* If -save-temps=obj and -o name, create the prefix to use for %b.
@@ -4300,8 +4302,8 @@ do_self_spec (const char *spec)
 
 	    default:
 	      read_cmdline_option (&global_options, &global_options_set,
-				   decoded_options + j, CL_DRIVER, &handlers,
-				   global_dc);
+				   decoded_options + j, UNKNOWN_LOCATION,
+				   CL_DRIVER, &handlers, global_dc);
 	      break;
 	    }
 	}
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c	(revision 166610)
+++ gcc/toplev.c	(working copy)
@@ -2357,7 +2357,7 @@ toplev_main (int argc, char **argv)
      enough to default flags appropriately.  */
   decode_options (&global_options, &global_options_set,
 		  save_decoded_options, save_decoded_options_count,
-		  global_dc);
+		  UNKNOWN_LOCATION, global_dc);
 
   init_local_tick ();
 
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in	(revision 166610)
+++ gcc/cp/Make-lang.in	(working copy)
@@ -54,7 +54,7 @@ c++: cc1plus$(exeext)
 .PHONY: c++
 
 g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
-    $(CONFIG_H) opts.h
+    $(CONFIG_H) $(OPTS_H)
 	(SHLIB_LINK='$(SHLIB_LINK)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/cp/g++spec.c)
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 166610)
+++ gcc/opts.c	(working copy)
@@ -347,6 +347,7 @@ static bool common_handle_option (struct
 				  struct gcc_options *opts_set,
 				  const struct cl_decoded_option *decoded,
 				  unsigned int lang_mask, int kind,
+				  location_t loc,
 				  const struct cl_option_handlers *handlers,
 				  diagnostic_context *dc);
 static void handle_param (struct gcc_options *opts,
@@ -359,6 +360,11 @@ static void set_debug_level (enum debug_
 static void set_fast_math_flags (struct gcc_options *opts, int set);
 static void set_unsafe_math_optimizations_flags (struct gcc_options *opts,
 						 int set);
+static void enable_warning_as_error (const char *arg, int value,
+				     unsigned int lang_mask,
+				     const struct cl_option_handlers *handlers,
+				     location_t loc,
+				     diagnostic_context *dc);
 
 /* Return a malloced slash-separated list of languages in MASK.  */
 static char *
@@ -493,6 +499,7 @@ lang_handle_option (struct gcc_options *
 		    struct gcc_options *opts_set,
 		    const struct cl_decoded_option *decoded,
 		    unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
+		    location_t loc,
 		    const struct cl_option_handlers *handlers,
 		    diagnostic_context *dc)
 {
@@ -501,7 +508,7 @@ lang_handle_option (struct gcc_options *
   gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
   return lang_hooks.handle_option (decoded->opt_index, decoded->arg,
-				   decoded->value, kind, handlers);
+				   decoded->value, kind, loc, handlers);
 }
 
 /* Handle a back-end option; arguments and return value as for
@@ -512,6 +519,7 @@ target_handle_option (struct gcc_options
 		      struct gcc_options *opts_set,
 		      const struct cl_decoded_option *decoded,
 		      unsigned int lang_mask ATTRIBUTE_UNUSED, int kind,
+		      location_t loc,
 		      const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
 		      diagnostic_context *dc)
 {
@@ -520,6 +528,7 @@ target_handle_option (struct gcc_options
   gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
   gcc_assert (kind == DK_UNSPECIFIED);
+  gcc_assert (loc == UNKNOWN_LOCATION);
   return targetm.handle_option (decoded->opt_index, decoded->arg,
 				decoded->value);
 }
@@ -605,15 +614,16 @@ flag_instrument_functions_exclude_p (tre
 }
 
 
-/* Handle the vector of command line options, storing the results of
-   processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT in OPTS and
-   OPTS_SET and using DC for diagnostic state.  LANG_MASK contains has
-   a single bit set representing the current language.  HANDLERS
-   describes what functions to call for the options.  */
+/* Handle the vector of command line options (located at LOC), storing
+   the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT
+   in OPTS and OPTS_SET and using DC for diagnostic state.  LANG_MASK
+   contains has a single bit set representing the current language.
+   HANDLERS describes what functions to call for the options.  */
 static void
 read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set,
 		      struct cl_decoded_option *decoded_options,
 		      unsigned int decoded_options_count,
+		      location_t loc,
 		      unsigned int lang_mask,
 		      const struct cl_option_handlers *handlers,
 		      diagnostic_context *dc)
@@ -640,7 +650,7 @@ read_cmdline_options (struct gcc_options
 	}
 
       read_cmdline_option (opts, opts_set,
-			   decoded_options + i, lang_mask, handlers,
+			   decoded_options + i, loc, lang_mask, handlers,
 			   dc);
     }
 }
@@ -712,8 +722,8 @@ decode_cmdline_options_to_array_default_
 
 /* If indicated by the optimization level LEVEL (-Os if SIZE is set,
    -Ofast if FAST is set), apply the option DEFAULT_OPT to OPTS and
-   OPTS_SET, diagnostic context DC, with language mask LANG_MASK and
-   option handlers HANDLERS.  */
+   OPTS_SET, diagnostic context DC, location LOC, with language mask
+   LANG_MASK and option handlers HANDLERS.  */
 
 static void
 maybe_default_option (struct gcc_options *opts,
@@ -722,6 +732,7 @@ maybe_default_option (struct gcc_options
 		      int level, bool size, bool fast,
 		      unsigned int lang_mask,
 		      const struct cl_option_handlers *handlers,
+		      location_t loc,
 		      diagnostic_context *dc)
 {
   const struct cl_option *option = &cl_options[default_opt->opt_index];
@@ -782,18 +793,20 @@ maybe_default_option (struct gcc_options
   if (enabled)
     handle_generated_option (opts, opts_set, default_opt->opt_index,
 			     default_opt->arg, default_opt->value,
-			     lang_mask, DK_UNSPECIFIED, handlers, dc);
+			     lang_mask, DK_UNSPECIFIED, loc,
+			     handlers, dc);
   else if (default_opt->arg == NULL
 	   && !(option->flags & CL_REJECT_NEGATIVE))
     handle_generated_option (opts, opts_set, default_opt->opt_index,
 			     default_opt->arg, !default_opt->value,
-			     lang_mask, DK_UNSPECIFIED, handlers, dc);
+			     lang_mask, DK_UNSPECIFIED, loc,
+			     handlers, dc);
 }
 
 /* As indicated by the optimization level LEVEL (-Os if SIZE is set,
    -Ofast if FAST is set), apply the options in array DEFAULT_OPTS to
-   OPTS and OPTS_SET, diagnostic context DC, with language mask
-   LANG_MASK and option handlers HANDLERS.  */
+   OPTS and OPTS_SET, diagnostic context DC, location LOC, with
+   language mask LANG_MASK and option handlers HANDLERS.  */
 
 static void
 maybe_default_options (struct gcc_options *opts,
@@ -802,13 +815,14 @@ maybe_default_options (struct gcc_option
 		       int level, bool size, bool fast,
 		       unsigned int lang_mask,
 		       const struct cl_option_handlers *handlers,
+		       location_t loc,
 		       diagnostic_context *dc)
 {
   size_t i;
 
   for (i = 0; default_opts[i].levels != OPT_LEVELS_NONE; i++)
     maybe_default_option (opts, opts_set, &default_opts[i],
-			  level, size, fast, lang_mask, handlers, dc);
+			  level, size, fast, lang_mask, handlers, loc, dc);
 }
 
 /* Table of options enabled by default at different levels.  */
@@ -902,6 +916,7 @@ default_options_optimization (struct gcc
 			      struct gcc_options *opts_set,
 			      struct cl_decoded_option *decoded_options,
 			      unsigned int decoded_options_count,
+			      location_t loc,
 			      unsigned int lang_mask,
 			      const struct cl_option_handlers *handlers,
 			      diagnostic_context *dc)
@@ -964,7 +979,7 @@ default_options_optimization (struct gcc
 
   maybe_default_options (opts, opts_set, default_options_table,
 			 opts->x_optimize, opts->x_optimize_size,
-			 ofast, lang_mask, handlers, dc);
+			 ofast, lang_mask, handlers, loc, dc);
 
   /* -O2 param settings.  */
   opt2 = (opts->x_optimize >= 2);
@@ -994,19 +1009,20 @@ default_options_optimization (struct gcc
   maybe_default_options (opts, opts_set,
 			 targetm.target_option.optimization_table,
 			 opts->x_optimize, opts->x_optimize_size,
-			 ofast, lang_mask, handlers, dc);
+			 ofast, lang_mask, handlers, loc, dc);
 }
 
 static void finish_options (struct gcc_options *, struct gcc_options *);
 
 /* Parse command line options and set default flag values.  Do minimal
    options processing.  The decoded options are in *DECODED_OPTIONS
-   and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC.  */
+   and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC;
+   the options are located at LOC.  */
 void
 decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
 		struct cl_decoded_option *decoded_options,
 		unsigned int decoded_options_count,
-		diagnostic_context *dc)
+		location_t loc, diagnostic_context *dc)
 {
   struct cl_option_handlers handlers;
 
@@ -1027,11 +1043,11 @@ decode_options (struct gcc_options *opts
 
   /* Enable -Werror=coverage-mismatch by default */
   enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers,
-			   dc);
+			   loc, dc);
 
   default_options_optimization (opts, opts_set,
 				decoded_options, decoded_options_count,
-				lang_mask, &handlers, dc);
+				loc, lang_mask, &handlers, dc);
 
 #ifdef ENABLE_LTO
   /* Clear any options currently held for LTO.  */
@@ -1039,7 +1055,8 @@ decode_options (struct gcc_options *opts
 #endif
 
   read_cmdline_options (opts, opts_set,
-			decoded_options, decoded_options_count, lang_mask,
+			decoded_options, decoded_options_count,
+			loc, lang_mask,
 			&handlers, dc);
 
   finish_options (opts, opts_set);
@@ -1585,6 +1602,7 @@ common_handle_option (struct gcc_options
 		      struct gcc_options *opts_set,
 		      const struct cl_decoded_option *decoded,
 		      unsigned int lang_mask, int kind ATTRIBUTE_UNUSED,
+		      location_t loc,
 		      const struct cl_option_handlers *handlers,
 		      diagnostic_context *dc)
 {
@@ -1765,7 +1783,7 @@ common_handle_option (struct gcc_options
       break;
 
     case OPT_Werror_:
-      enable_warning_as_error (arg, value, lang_mask, handlers, dc);
+      enable_warning_as_error (arg, value, lang_mask, handlers, loc, dc);
       break;
 
     case OPT_Wlarger_than_:
@@ -2395,13 +2413,13 @@ get_option_state (struct gcc_options *op
 
 /* Enable (or disable if VALUE is 0) a warning option ARG (language
    mask LANG_MASK, option handlers HANDLERS) as an error for
-   diagnostic context DC (possibly NULL).  This is used by
-   -Werror=.  */
+   diagnostic context DC (possibly NULL), location LOC.  This is used
+   by -Werror=.  */
 
-void
+static void
 enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,
 			 const struct cl_option_handlers *handlers,
-			 diagnostic_context *dc)
+			 location_t loc, diagnostic_context *dc)
 {
   char *new_option;
   int option_index;
@@ -2424,8 +2442,7 @@ enable_warning_as_error (const char *arg
       if (option_index == OPT_SPECIAL_ignore)
 	return;
       if (dc)
-	diagnostic_classify_diagnostic (dc, option_index, kind,
-					UNKNOWN_LOCATION);
+	diagnostic_classify_diagnostic (dc, option_index, kind, loc);
       if (kind == DK_ERROR)
 	{
 	  const struct cl_option * const option = cl_options + option_index;
@@ -2434,8 +2451,7 @@ enable_warning_as_error (const char *arg
 	  if (option->var_type == CLVC_BOOLEAN)
 	    handle_generated_option (&global_options, &global_options_set,
 				     option_index, NULL, value, lang_mask,
-				     (int)kind, handlers,
-				     dc);
+				     (int)kind, loc, handlers, dc);
 	}
     }
   free (new_option);
Index: gcc/opts.h
===================================================================
--- gcc/opts.h	(revision 166610)
+++ gcc/opts.h	(working copy)
@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3.  
 #ifndef GCC_OPTS_H
 #define GCC_OPTS_H
 
+#include "input.h"
+
 /* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR.  */
 enum cl_var_type {
   /* The switch is enabled when FLAG_VAR is nonzero.  */
@@ -164,7 +166,7 @@ struct cl_option_handler_func
   bool (*handler) (struct gcc_options *opts,
 		   struct gcc_options *opts_set,
 		   const struct cl_decoded_option *decoded,
-		   unsigned int lang_mask, int kind,
+		   unsigned int lang_mask, int kind, location_t loc,
 		   const struct cl_option_handlers *handlers,
 		   diagnostic_context *dc);
 
@@ -225,6 +227,7 @@ extern void decode_options (struct gcc_o
 			    struct gcc_options *opts_set,
 			    struct cl_decoded_option *decoded_options,
 			    unsigned int decoded_options_count,
+			    location_t loc,
 			    diagnostic_context *dc);
 extern int option_enabled (int opt_idx, void *opts);
 extern bool get_option_state (struct gcc_options *, int,
@@ -232,18 +235,12 @@ extern bool get_option_state (struct gcc
 extern void set_option (struct gcc_options *opts,
 			struct gcc_options *opts_set,
 			int opt_index, int value, const char *arg, int kind,
-			diagnostic_context *dc);
+			location_t loc, diagnostic_context *dc);
 extern void *option_flag_var (int opt_index, struct gcc_options *opts);
-bool handle_option (struct gcc_options *opts,
-		    struct gcc_options *opts_set,
-		    const struct cl_decoded_option *decoded,
-		    unsigned int lang_mask, int kind,
-		    const struct cl_option_handlers *handlers,
-		    bool generated_p, diagnostic_context *dc);
 bool handle_generated_option (struct gcc_options *opts,
 			      struct gcc_options *opts_set,
 			      size_t opt_index, const char *arg, int value,
-			      unsigned int lang_mask, int kind,
+			      unsigned int lang_mask, int kind, location_t loc,
 			      const struct cl_option_handlers *handlers,
 			      diagnostic_context *dc);
 void generate_option (size_t opt_index, const char *arg, int value,
@@ -254,12 +251,9 @@ void generate_option_input_file (const c
 extern void read_cmdline_option (struct gcc_options *opts,
 				 struct gcc_options *opts_set,
 				 struct cl_decoded_option *decoded,
+				 location_t loc,
 				 unsigned int lang_mask,
 				 const struct cl_option_handlers *handlers,
 				 diagnostic_context *dc);
-extern void enable_warning_as_error (const char *arg, int value,
-				     unsigned int lang_mask,
-				     const struct cl_option_handlers *handlers,
-				     diagnostic_context *dc);
 extern void print_ignored_options (void);
 #endif
Index: gcc/ada/gcc-interface/Make-lang.in
===================================================================
--- gcc/ada/gcc-interface/Make-lang.in	(revision 166610)
+++ gcc/ada/gcc-interface/Make-lang.in	(working copy)
@@ -1231,7 +1231,7 @@ ada/decl.o : ada/gcc-interface/decl.c $(
 ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \
    $(FLAGS_H) debug.h toplev.h langhooks.h \
-   $(LANGHOOKS_DEF_H) opts.h $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \
+   $(LANGHOOKS_DEF_H) $(OPTS_H) $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \
    ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \
    ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \
    ada/sinfo.h ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \
Index: gcc/ada/gcc-interface/misc.c
===================================================================
--- gcc/ada/gcc-interface/misc.c	(revision 166610)
+++ gcc/ada/gcc-interface/misc.c	(working copy)
@@ -102,7 +102,7 @@ gnat_parse_file (int set_yydebug ATTRIBU
 
 static bool
 gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value,
-		    int kind ATTRIBUTE_UNUSED,
+		    int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED,
 		    const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
 {
   enum opt_code code = (enum opt_code) scode;
Index: gcc/fortran/Make-lang.in
===================================================================
--- gcc/fortran/Make-lang.in	(revision 166610)
+++ gcc/fortran/Make-lang.in	(working copy)
@@ -78,7 +78,7 @@ fortran: f951$(exeext)
 .PHONY: fortran
 
 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
-	$(CONFIG_H) coretypes.h intl.h opts.h
+	$(CONFIG_H) coretypes.h intl.h $(OPTS_H)
 	(SHLIB_LINK='$(SHLIB_LINK)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
Index: gcc/fortran/gfortran.h
===================================================================
--- gcc/fortran/gfortran.h	(revision 166610)
+++ gcc/fortran/gfortran.h	(working copy)
@@ -2395,7 +2395,7 @@ unsigned int gfc_option_lang_mask (void)
 void gfc_init_options_struct (struct gcc_options *);
 void gfc_init_options (unsigned int,
 		       struct cl_decoded_option *);
-bool gfc_handle_option (size_t, const char *, int, int,
+bool gfc_handle_option (size_t, const char *, int, int, location_t,
 			const struct cl_option_handlers *);
 bool gfc_post_options (const char **);
 char *gfc_get_option_string (void);
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c	(revision 166610)
+++ gcc/fortran/options.c	(working copy)
@@ -548,7 +548,7 @@ gfc_handle_runtime_check_option (const c
 
 bool
 gfc_handle_option (size_t scode, const char *arg, int value,
-		   int kind ATTRIBUTE_UNUSED,
+		   int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED,
 		   const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
 {
   bool result = true;
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 166610)
+++ gcc/langhooks.c	(working copy)
@@ -356,6 +356,7 @@ bool
 lhd_handle_option (size_t code ATTRIBUTE_UNUSED,
 		   const char *arg ATTRIBUTE_UNUSED,
 		   int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED,
+		   location_t loc ATTRIBUTE_UNUSED,
 		   const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
 {
   return false;
Index: gcc/langhooks.h
===================================================================
--- gcc/langhooks.h	(revision 166610)
+++ gcc/langhooks.h	(working copy)
@@ -291,10 +291,12 @@ struct lang_hooks
      checking whether ARG is NULL, which indicates that no argument
      was in fact supplied.  For -f and -W switches, VALUE is 1 or 0
      for the positive and negative forms respectively.  HANDLERS should
-     be passed to any recursive handle_option calls.
+     be passed to any recursive handle_option calls.  LOC is the
+     location of the option.
 
      Return true if the switch is valid, false if invalid.  */
   bool (*handle_option) (size_t code, const char *arg, int value, int kind,
+			 location_t loc,
 			 const struct cl_option_handlers *handlers);
 
   /* Called when all command line options have been parsed to allow
Index: gcc/lto/Make-lang.in
===================================================================
--- gcc/lto/Make-lang.in	(revision 166610)
+++ gcc/lto/Make-lang.in	(working copy)
@@ -80,7 +80,7 @@ lto/lto-lang.o: lto/lto-lang.c $(CONFIG_
 	flags.h $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(SYSTEM_H) \
 	$(TARGET_H) $(LTO_H) $(GIMPLE_H) gtype-lto.h gt-lto-lto-lang.h \
 	$(EXPR_H)
-lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h opts.h \
+lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
 	toplev.h $(TREE_H) $(DIAGNOSTIC_CORE_H) $(TM_H) \
 	$(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \
 	langhooks.h $(VEC_H) $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \
Index: gcc/lto/lto-lang.c
===================================================================
--- gcc/lto/lto-lang.c	(revision 166610)
+++ gcc/lto/lto-lang.c	(working copy)
@@ -657,6 +657,7 @@ const char *resolution_file_name;
 static bool
 lto_handle_option (size_t scode, const char *arg,
 		   int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED,
+		   location_t loc ATTRIBUTE_UNUSED,
 		   const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
 {
   enum opt_code code = (enum opt_code) scode;
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 166610)
+++ gcc/Makefile.in	(working copy)
@@ -932,6 +932,7 @@ PREDICT_H = predict.h predict.def
 CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \
 	$(srcdir)/../libcpp/include/cpplib.h
 INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h
+OPTS_H = $(INPUT_H) opts.h
 DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \
 	$(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h \
 	$(DECNUMFMT)/decimal128.h $(DECNUMFMT)/decimal128Local.h
@@ -2005,7 +2006,7 @@ c-convert.o : c-convert.c $(CONFIG_H) $(
 c-decl.o : c-decl.c c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	$(TREE_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) \
 	output.h debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) \
-	$(TIMEVAR_H) opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) \
+	$(TIMEVAR_H) $(OPTS_H) $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) \
 	$(HASHTAB_H) $(LIBFUNCS_H) $(EXCEPT_H) $(LANGHOOKS_DEF_H) \
 	$(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) $(DIAGNOSTIC_CORE_H) \
 	$(INPUT_H) langhooks.h tree-mudflap.h pointer-set.h tree-iterator.h \
@@ -2081,7 +2082,7 @@ c-family/c-common.o : c-family/c-common.
 	$(GGC_H) builtin-types.def builtin-attrs.def \
 	$(DIAGNOSTIC_H) langhooks.h \
 	$(TARGET_H) tree-iterator.h langhooks.h tree-mudflap.h \
-	intl.h opts.h $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
+	intl.h $(OPTS_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
 	$(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \
 	$(LIBFUNCS_H) \
 	gt-c-family-c-common.h
@@ -2118,14 +2119,14 @@ c-family/c-omp.o : c-family/c-omp.c $(CO
 c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
         $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \
         $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H)	\
-        opts.h $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
+        $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
 		$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
 
 c-family/c-pch.o : c-family/c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(CPPLIB_H) $(TREE_H) $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) \
 	$(GGC_H) debug.h langhooks.h $(FLAGS_H) hosthooks.h version.h \
-	$(TARGET_H) opts.h $(TIMEVAR_H)
+	$(TARGET_H) $(OPTS_H) $(TIMEVAR_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
 	  -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
 	  $< $(OUTPUT_OPTION)
@@ -2137,7 +2138,7 @@ c-family/c-ppoutput.o : c-family/c-ppout
 c-family/c-pragma.o: c-family/c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(TM_H) $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h \
 	$(TM_P_H) $(C_COMMON_H) $(TARGET_H) $(CPPLIB_H) $(FLAGS_H) \
-	$(DIAGNOSTIC_H) opts.h $(PLUGINS_H) \
+	$(DIAGNOSTIC_H) $(OPTS_H) $(PLUGINS_H) \
 	gt-c-family-c-pragma.h
 
 c-family/c-pretty-print.o : c-family/c-pretty-print.c $(C_PRETTY_PRINT_H) \
@@ -2190,21 +2191,21 @@ DRIVER_DEFINES = \
 
 gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
     Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
-    configargs.h $(OBSTACK_H) opts.h $(DIAGNOSTIC_H)
+    configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H)
 	(SHLIB_LINK='$(SHLIB_LINK)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
   -c $(srcdir)/gcc.c $(OUTPUT_OPTION))
 
 gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
-    opts.h
+    $(OPTS_H)
 	(SHLIB_LINK='$(SHLIB_LINK)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
   -c $(srcdir)/gccspec.c $(OUTPUT_OPTION))
 
 cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
-    opts.h
+    $(OPTS_H)
 
 specs.h : s-specs ; @true
 s-specs : Makefile
@@ -2232,9 +2233,9 @@ s-options-h: optionlist $(srcdir)/opt-fu
 	$(STAMP) $@
 
 options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \
-	$(TM_H) opts.h intl.h
+	$(TM_H) $(OPTS_H) intl.h
 
-gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h
+gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OPTS_H) intl.h
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(OUTPUT_OPTION) \
 		-DGCC_DRIVER options.c
 
@@ -2315,7 +2316,7 @@ lto-symtab.o: lto-symtab.c $(CONFIG_H) $
    toplev.h $(TREE_H) $(GIMPLE_H) $(GGC_H) $(LAMBDA_H) $(HASHTAB_H) \
    $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h
 lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
-   $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) opts.h $(OPTIONS_H) \
+   $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) $(OPTS_H) $(OPTIONS_H) \
    $(TARGET_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(LTO_STREAMER_H)
 lto-streamer.o: lto-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h   \
    $(TM_H) $(TREE_H) $(GIMPLE_H) $(BITMAP_H) $(LTO_STREAMER_H) $(FLAGS_H) \
@@ -2807,12 +2808,12 @@ fold-const.o : fold-const.c $(CONFIG_H) 
    $(GIMPLE_H) realmpfr.h $(TREE_FLOW_H)
 diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def
-opts.o : opts.c opts.h $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
+opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \
    output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
    $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \
    $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h
-opts-common.o : opts-common.c opts.h $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \
+opts-common.o : opts-common.c $(OPTS_H) $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H)
 targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
    $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \
@@ -2837,7 +2838,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM
    value-prof.h $(PARAMS_H) $(TM_P_H) reload.h ira.h dwarf2asm.h $(TARGET_H) \
    langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \
    $(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \
-   opts.h params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
+   $(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
    tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
    tree-pretty-print.h opts-diagnostic.h
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
@@ -2852,7 +2853,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM
    $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
    langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) \
    hosthooks.h $(CGRAPH_H) $(COVERAGE_H) $(TREE_PASS_H) $(TREE_DUMP_H) \
-   $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h $(TREE_FLOW_H) $(TREE_INLINE_H) \
+   $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) $(OPTS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \
    gt-passes.h $(DF_H) $(PREDICT_H) $(LTO_HEADER_H) $(LTO_SECTION_OUT_H) \
    $(PLUGIN_H)
 
@@ -3032,7 +3033,7 @@ matrix-reorg.o : matrix-reorg.c $(CONFIG
    tree-flow-inline.h langhooks.h $(HASHTAB_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) \
    debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_CORE_H) $(TIMEVAR_H) \
    $(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) \
-   $(CFGLOOP_H) tree-iterator.h $(TREE_PASS_H) opts.h $(TREE_DATA_REF_H) \
+   $(CFGLOOP_H) tree-iterator.h $(TREE_PASS_H) $(OPTS_H) $(TREE_DATA_REF_H) \
    tree-ssa-sccvn.h
 ipa-inline.o : ipa-inline.c gt-ipa-inline.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
@@ -3064,7 +3065,7 @@ ipa-struct-reorg.o: ipa-struct-reorg.c i
    $(TREE_FLOW_H) langhooks.h pointer-set.h $(HASHTAB_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \
    $(FLAGS_H) debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
    $(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) tree-iterator.h \
-   $(TREE_PASS_H) opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) \
+   $(TREE_PASS_H) $(OPTS_H) $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) \
    $(GIMPLE_H) tree-pretty-print.h gimple-pretty-print.h
 
 coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -4494,7 +4495,7 @@ installdirs:
 
 PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_PASS_H) $(GCC_PLUGIN_H) \
-  $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) opts.h $(PARAMS_H) plugin.def \
+  $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) plugin.def \
   $(tm_file_list) $(tm_include_list) $(tm_p_file_list) $(tm_p_include_list) \
   $(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
   intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) $(C_COMMON_H) $(C_PRETTY_PRINT_H) \
Index: gcc/lto-opts.c
===================================================================
--- gcc/lto-opts.c	(revision 166610)
+++ gcc/lto-opts.c	(working copy)
@@ -404,7 +404,7 @@ lto_reissue_options (void)
       if (flag_var)
 	set_option (&global_options, &global_options_set,
 		    o->code, o->value, o->arg,
-		    DK_UNSPECIFIED, global_dc);
+		    DK_UNSPECIFIED, UNKNOWN_LOCATION, global_dc);
 
       if (o->type == CL_TARGET)
 	targetm.handle_option (o->code, o->arg, o->value);
Index: gcc/langhooks-def.h
===================================================================
--- gcc/langhooks-def.h	(revision 166610)
+++ gcc/langhooks-def.h	(working copy)
@@ -68,7 +68,7 @@ extern void lhd_initialize_diagnostics (
 extern void lhd_init_options (unsigned int,
 			      struct cl_decoded_option *);
 extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
-extern bool lhd_handle_option (size_t, const char *, int, int,
+extern bool lhd_handle_option (size_t, const char *, int, int, location_t,
 			       const struct cl_option_handlers *);
 extern tree lhd_callgraph_analyze_expr (tree *, int *);
 
