Index: gcc/doc/options.texi
===================================================================
--- gcc/doc/options.texi	(revision 187096)
+++ gcc/doc/options.texi	(working copy)
@@ -457,6 +457,8 @@ the value has been set explicitly and sh
 combined option.  For example, some front ends use this to prevent
 @option{-ffast-math} and @option{-fno-fast-math} from changing the
 value of @option{-fmath-errno} for languages that do not use
 @code{errno}.
 
+@item EnabledBy(@var{opt})
+If not explicitly set, the option is set to the value of @option{-@var{opt}}.
 @end table
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 187096)
+++ gcc/opts.c	(working copy)
@@ -813,33 +813,22 @@ finish_options (struct gcc_options *opts
   if (!opts->x_flag_tree_vectorize || !opts->x_flag_tree_loop_if_convert)
     maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
                            opts->x_param_values, opts_set->x_param_values);
 
   /* This replaces set_Wunused.  */
-  if (opts->x_warn_unused_function == -1)
-    opts->x_warn_unused_function = opts->x_warn_unused;
-  if (opts->x_warn_unused_label == -1)
-    opts->x_warn_unused_label = opts->x_warn_unused;
   /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled.  */
   if (opts->x_warn_unused_parameter == -1)
     opts->x_warn_unused_parameter = (opts->x_warn_unused
 				     && opts->x_extra_warnings);
-  if (opts->x_warn_unused_variable == -1)
-    opts->x_warn_unused_variable = opts->x_warn_unused;
   /* Wunused-but-set-parameter is enabled if both -Wunused -Wextra are
      enabled.  */
   if (opts->x_warn_unused_but_set_parameter == -1)
     opts->x_warn_unused_but_set_parameter = (opts->x_warn_unused
 					     && opts->x_extra_warnings);
-  if (opts->x_warn_unused_but_set_variable == -1)
-    opts->x_warn_unused_but_set_variable = opts->x_warn_unused;
-  if (opts->x_warn_unused_value == -1)
-    opts->x_warn_unused_value = opts->x_warn_unused;
-
-  /* This replaces set_Wextra.  */
-  if (opts->x_warn_uninitialized == -1)
-    opts->x_warn_uninitialized = opts->x_extra_warnings;
+  /* This is an auto-generated function. It should do most of the
+     above in the future.  */
+  finish_options_generated (opts, opts_set);
 }
 
 #define LEFT_COLUMN	27
 
 /* Output ITEM, of length ITEM_WIDTH, in the left column,
Index: gcc/optc-gen.awk
===================================================================
--- gcc/optc-gen.awk	(revision 187096)
+++ gcc/optc-gen.awk	(working copy)
@@ -322,6 +322,27 @@ for (i = 0; i < n_opts; i++) {
 	       var_set(flags[i]), comma)
 }
 
 print "};"
 
+print "\n\n"
+print "void finish_options_generated(struct gcc_options *opts, struct gcc_options *opts_set)\n{"
+for (i = 0; i < n_opts; i++) {
+    opt_var_name = var_name(flags[i])
+    enabledby_arg = opt_args("EnabledBy", flags[i])
+    for (j = 0; nth_arg(j, enabledby_arg) != ""; j++) {
+        enabledby_name = nth_arg(j, enabledby_arg)
+        enabledby_index = opt_numbers[enabledby_name]
+        if (enabledby_index == "-1") {
+            print "#error Enabledby: " enabledby_name 
+        } else {
+            enabledby_var_name = var_name(flags[enabledby_index])
+            print "   /* " opts[i] " is enabled by " enabledby_name ".  */"
+            print "   if (!opts_set->x_" opt_var_name ")"
+            print "   {"
+            print "     opts->x_" opt_var_name " = opts->x_" enabledby_var_name ";"
+            print "   }"
+        }
+    }
+}
+print "}"
 }
Index: gcc/opth-gen.awk
===================================================================
--- gcc/opth-gen.awk	(revision 187096)
+++ gcc/opth-gen.awk	(working copy)
@@ -291,10 +291,12 @@ print "";
 print "/* Restore selected option variables from a structure.  */"
 print "extern void cl_target_option_restore (struct gcc_options *, struct cl_target_option *);";
 print "";
 print "/* Print target option variables from a structure.  */";
 print "extern void cl_target_option_print (FILE *, int, struct cl_target_option *);";
+print "";
+print "void finish_options_generated(struct gcc_options *opts, struct gcc_options *opts_set);";
 print "#endif";
 print "";
 
 for (i = 0; i < n_opts; i++) {
 	name = opt_args("Mask", flags[i])
Index: gcc/common.opt
===================================================================
--- gcc/common.opt	(revision 187096)
+++ gcc/common.opt	(working copy)
@@ -648,11 +648,11 @@ Warn whenever a trampoline is generated
 Wtype-limits
 Common Var(warn_type_limits) Init(-1) Warning
 Warn if a comparison is always true or always false due to the limited range of the data type
 
 Wuninitialized
-Common Var(warn_uninitialized) Init(-1) Warning
+Common Var(warn_uninitialized) Warning EnabledBy(Wextra)
 Warn about uninitialized automatic variables
 
 Wmaybe-uninitialized
 Common Var(warn_maybe_uninitialized) Warning
 Warn about maybe uninitialized automatic variables
@@ -668,31 +668,31 @@ Enable all -Wunused- warnings
 Wunused-but-set-parameter
 Common Var(warn_unused_but_set_parameter) Init(-1) Warning
 Warn when a function parameter is only set, otherwise unused
 
 Wunused-but-set-variable
-Common Var(warn_unused_but_set_variable) Init(-1) Warning
+Common Var(warn_unused_but_set_variable) Warning EnabledBy(Wunused)
 Warn when a variable is only set, otherwise unused
 
 Wunused-function
-Common Var(warn_unused_function) Init(-1) Warning
+Common Var(warn_unused_function) Warning EnabledBy(Wunused)
 Warn when a function is unused
 
 Wunused-label
-Common Var(warn_unused_label) Init(-1) Warning
+Common Var(warn_unused_label) Warning EnabledBy(Wunused)
 Warn when a label is unused
 
 Wunused-parameter
 Common Var(warn_unused_parameter) Init(-1) Warning
 Warn when a function parameter is unused
 
 Wunused-value
-Common Var(warn_unused_value) Init(-1) Warning
+Common Var(warn_unused_value) Warning EnabledBy(Wunused)
 Warn when an expression value is unused
 
 Wunused-variable
-Common Var(warn_unused_variable) Init(-1) Warning
+Common Var(warn_unused_variable) Warning EnabledBy(Wunused)
 Warn when a variable is unused
 
 Wcoverage-mismatch
 Common Var(warn_coverage_mismatch) Init(1) Warning
 Warn in case profiles in -fprofile-use do not match
Index: gcc/opt-read.awk
===================================================================
--- gcc/opt-read.awk	(revision 187096)
+++ gcc/opt-read.awk	(working copy)
@@ -106,10 +106,11 @@ BEGIN {
 		}
 		else {
 			name = opt_args("Mask", $1)
 			if (name == "") {
 				opts[n_opts]  = $1
+				opt_numbers[$1] = n_opts
 				flags[n_opts] = $2
 				help[n_opts]  = $3
 				for (i = 4; i <= NF; i++)
 					help[n_opts] = help[n_opts] " " $i
 				n_opts++;
