This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about new warning system
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: "Giovanni Bajo" <rasky at develer dot com>
- Cc: <dj at redhat dot com>, <gcc at gcc dot gnu dot org>
- Date: 10 Jun 2005 17:27:00 +0200
- Subject: Re: Question about new warning system
- References: <025901c56dc2$20fbe7f0$bf03030a@trilan>
"Giovanni Bajo" <rasky@develer.com> 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