This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DR handling for C++
On Mon, 20 Sep 2004, Matt Austern wrote:
> Isn't the fundamental problem that we're using pedwarns differently in the C
> and C++ front ends? In the C front end you don't even see pedwarns unless you
> use a special compiler flag, and making them into errors requires an even more
> special compiler flag. It's very odd that it means something so different in
> the C++ front end.
If pedwarn() is executed, you see the diagnostic, for both C and C++ - no
special flag is required. -pedantic is only relevant to if (pedantic)
pedwarn (...).
Every case where "pedantic" is checked represents some form of extension.
Every such case should be documented as an extension, or the conditioning
on pedantic removed.
pedwarn() is used where the standard requires a diagnostic but it hasn't
been decided to make the relevant condition a hard error (or, in C++, it
has been decided to permit the relevant condition under -fpermissive).
Such cases should all also be documented (with details of the semantics
assigned to the cases which the standard says are ill-formed but we
permit) or removed (changed to hard errors). (There may also be some
cases where the standard permits the code to be rejected but does not
require a diagnostic, where pedwarn() has been chosen.)
In both cases, and for both C and C++, one can document or remove any
individual extension without needing to do all the others at the same
time.
The name pedwarn() has been a bit confusing (because it suggests a link to
-pedantic which isn't really there, the link being that -pedantic-errors
turns pedwarns from warnings to errors), but I don't have a good
suggestion for a less confusing name.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)