This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
compiler-defined __PEDANTIC__ macro
On Wed, Dec 11, 2002 at 02:39:35PM -0500, Phil Edwards wrote:
> On Wed, Dec 11, 2002 at 11:01:27AM -0800, Nathan Myers wrote:
> >
> > This is not to say we shouldn't have a cpp macro defined
> > when the compiler is run with -pedantic.
>
> ... Historically GCC has never defined any macros based on
> warning options, to prevent users from doing things like
>
> #if warning_level_is_high
> do something safe to claim "no warnings!" and look good
> #else
> do something idiotic that would be warned about
> #endif
>
> I think it took quite a bit of convincing just to get the __OPTIMIZE__
> macro added for glibc's use.
Clearly somebody was confused. It's one thing to reject a feature
whose only or main purpose is to enable bad code (declaring our
destructors as non-throwing would be such a "feature") and quite
another thing to reject a feature just because it _can_ be used to
enable bad code, besides supporting useful semantics.
A macro that enables us to report conformance problems in the
library under the same interface as for the base compiler clearly
falls in the latter category. So ought a macro revealing warning
levels, for that matter.
Nathan Myers
ncm-nospam@cantrip.org