http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137

--- Comment #23 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-29 
09:22:05 UTC ---
It is explained here
http://gcc.gnu.org/onlinedocs/gccint/Option-properties.html#Option-properties

A patch like the following should work (plus removing the special handling in
c-opts.c)

Index: c.opt
===================================================================
--- c.opt    (revision 187628)
+++ c.opt    (working copy)
@@ -463,7 +463,7 @@
 Warn about suspicious declarations of \"main\"

 Wmissing-braces
-C ObjC C++ ObjC++ Var(warn_missing_braces) Warning
+C ObjC C++ ObjC++ Var(warn_missing_braces) Warning LangEnabledBy(C ObjC, Wall)
 Warn about possibly missing braces around initializers


There is also EnabledBy, which is unconditional. The plan is to convert
sub-options to use this infrastructure. There is also some functionality
missing:

* An option enabled only if two options are combined. (-Wextra && -Wunused
enable -Wunused-parameter).

* An option enabled by some arbitrary condition.

And some options are problematic because they currently have bugs: warn_format
is 0 by default but the value of -Wformat in the gcc_opts structure is -1, thus
calling warning(OPT_Wformat) without checking warn_format means enabled by
default. Some tests expect such diagnostics to be enabled by default. :-(

Reply via email to