"Giovanni Bajo" <[EMAIL PROTECTED]> writes: | Hello DJ, | | I'm updating a piece of code of the C++ frontend which involves a warning, | so I was planning on adding the correct warning option to it. The original | code is the following: | | if (warn_missing_braces) | warning (0, "missing braces around initializer"); | | So, what is the correct way of fixing this: | | [1] | if (warn_missing_braces) | warning (OPT_Wmissing_braces, "missing braces around | initializer"); | | [2] | if (OPT_Wmissing_braces) | warning (OPT_Wmissing_braces, "missing braces around | initializer"); | | [3] | warning (OPT_Wmissing_braces, "missing braces around initializer"); | | What is the difference between [1], [2], [3]?
[3] shows which options is used to enable/disable that diagnostic (assumming it is controled by a particular switch). In either case the main diagnostic is always emitted. As pointed out by JSM yesterday, it is not clear whether [1] should be preferred over [2] or the converse. I think having two ways to control the same diagnostic is a bit confusing. I think the difference between [1] and [2] is that warn_xxx can be true even though OPT_Wxxxx is not explicitly specified -- e.g. it could be set as a consequence of setting another flag. -- Gaby