On 08/01/2008, Ismail Dönmez <[EMAIL PROTECTED]> wrote:
> Tuesday 08 January 2008 23:34:13 tarihinde Joe Buck şunları yazmıştı:
>
> > Since people have  already built whole distros with the gcc from the trunk,
> > clearly theyare managing to build C++ applications that use
> > Python,libmp4v2, libjpeg etc.
>
> Yes true because they use -fpermissive which will let this error into a
> warning, which also suggests this change is not good.
>

Hi Ismail,

I implemented the change as the fix to a bug that was reported by
fellow (and more senior) GCC developers. Let me try to explain
(although, I hoped that it will be fairly clear from
gcc.gnu.org/gcc-4.3/changes.html).

We have a series of diagnostics that are important or required by the
standard (or both). Those are called pedwarns. It is an unfortunate
name for two reasons: 1) Not all pedwarns are enabled by -pedantic,
some are enabled by default; and 2) pedwarns can be either warnings or
errors, and what they are depends on command-line options and the
default of each front-end.  In fact, pedwarnss are warnings by default
in the C front-end. But they are errors by default in the C++
front-end unless you use -fpermissive so they are downgraded to
warnings.

Before GCC 4.3, the C++ preprocessor was ignoring the default of the
C++ front-end. In fact, there was an inconsistence between the
settings of the C++ preprocessor and the settings of the C++
front-end. It worked for a few things (-pedantic-errors worked fine),
but not for others (the default settings and the effect of
-fpermissive). The inconsistency was evident in the code and if you
played with combinations of -pedantic-errors and -fpermissive.

I hope you see. It is not that we decided that some warnings should
actually be errors. It is that those warnings belong to a group of
diagnostics that were supposed to be errors by default. Of course, we
can discuss whether those warnings (or a particular one) should be
enabled by default, or whether they (or a particular one of them)
should belong to that group of diagnostics (pedwarns) or whether
pedwarns should be errors by default in C++ front-end.

I was hoping those discussions would arise but it didn't happen. It
seems people just used -fpermissive or fixed the warning.

For your particular example, you could open a regression bug against
4.3 that says:

* '"foo' redefined" is not mandated by the standard or it is not
serious enough, so it should not be a pedwarn just a normal warning;
or

* "'foo' redefined", although mandated by the standard, is a nuisance
and irrelevant, it should only be active when -pedantic is given and
not by default.

The fixes to those are one-liners once the correct decision is made. I
volunteer (in fact, I have volunteered repeatedly) to implement, test
and commit the changes needed. But I don't consider that I have the
expertise to make the correct decision.

But reverting my patch is just a quick hack that won't fix anything
for long, since in the future the preprocessor will probably use the
same diagnostic machinery that the front-ends, making impossible the
inconsistency described above and, thus, bringing up this whole issue
again.

I hope I have been clear in my explanation.

Cheers,

Manuel.

Reply via email to