This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Changes in C++ FE regarding pedwarns to be errors are harmful
On 14/01/2008, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 13/01/2008, Jonathan Wakely wrote:
> >
> > I think all others should change to permerrors.
>
> I only meant all others in cp/decl.c of course - here are the remaining files.
> Again I've only listed the ones that should remain as pedwarns and
> other special cases - most change to permerrors.
>
Thanks for doing this!
> Another interesting one. Variadic templates work in C++98 mode and
> are used internally, but currently you have to say -fpermissive to use
> them in user code. That flag is *usually* needed for
> backward-compatibility, not enabling *future* extensions.
That is because we didn't have permerror and the semantics of
fpermissive were not clear. Now it is evident that this should be a
pedwarn. Wow, you found probably the best example of why the current
C++ FE behaviour is confusing.
> So is support for variadic templates in -std=gnu98 mode an official
> extension, or a detail not-for-public-consumption?
Well, right now you can use it if you use fpermissive, so if it wasn't
for public-consumption, using pedwarn instead of error was not the
right thing in the first place. So pedwarn.
> I think for consistency with the new proposed behaviour it should
> check flag_permissive, instead of !flag_pedantic_errors, do you agree?
>
Yes, this is the type of thing I am looking when reviewing your
suggestions, since they are a potential source of bugs. In my patch I
changed a few.
> In cp/typeck.c the pedwarns guarded by pedantic should stay as pedwarns.
> on line 5356 there is:
> if (pedantic)
> /* Only issue a warning, as we have always supported this
> where possible, and it is necessary in some cases. DR 195
> addresses this issue, but as of 2004/10/26 is still in
> drafting. */
> warning (0, "ISO C++ forbids casting between pointer-to-function and
> pointer-to-object");
>
> This could switch to a pedwarn, since that will still be a warning
> under the permerror proposal. That would mean it can be turned into a
> fatal error with -pedantic-errors instead of -Werror, which would be
> consistent with other warnings that are only enabled by -pedantic.
> I'm not sure how "conditionally-supported behaviour" should interact
> with -pedantic-errors so let's leave as a warning for now.
This is another example of trying to workaround the wrong default of
pedwarns. This should be a pedwarn. The reason why is a warning is
that pedantic-errors was active by default and that didn't make sense.
We are changing this, so we don't need this hack anymore.
> Is that all of them? Would you prefer a patch to make the changes or
> are you going to go through them yourself anyway?
I agree with all your other suggestions. I will try to go through them
in the following days and submit a follow-up patch to the ones already
submitted.
Many thanks! That was impressive.
Manuel.