This is the mail archive of the
mailing list for the GCC project.
Re: diagnostic.c reorganization
On Sun, 11 May 2003, Zack Weinberg wrote:
> How's this text?
> A pedantic warning. The effect is the same as "warning" unless
> -pedantic-errors was given on the command line, which elevates the
> severity to "error". Use this for any diagnostic which is required
> by the relevant language standard, but which is not to be an error.
> There are two subcategories of pedantic warnings: mandatory and
> optional. Mandatory pedwarns are for code which is definitely
> wrong per the standard, but the programmer's intent is clear, so
> the code can still be compiled. Optional pedwarns are for code
> where the standard's requirement is considered too restrictive.
> Just calling pedwarn produces a mandatory pedwarn; to get an
> optional pedwarn, write "if (pedantic) pedwarn (...);".
It looks correct, except for the peculiarity of mandatory pedwarns being
errors by default in C++. I'm not sure of the rationale for the
difference (a documented change in 2.95: (from cp/NEWS)
*** Changes in GCC 2.95:
* Messages about non-conformant code that we can still handle ("pedwarns")
are now errors by default, rather than warnings. This can be reverted
with -fpermissive, and is overridden by -pedantic or -pedantic-errors.
Joseph S. Myers