This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
cpp(lib) vs. pedantic warnings vs. -Werror.
- To: gcc at gcc dot gnu dot org
- Subject: cpp(lib) vs. pedantic warnings vs. -Werror.
- From: cgd at sibyte dot com (Chris G. Demetriou)
- Date: 11 Jan 2001 14:35:27 -0800
I'm using GCC sources checked out of the trunk as of 2001-01-03 00:00
GMT, and am wondering about some behaviour i'm seeing.
I'm invoking gcc as with various flags including -Wall -Werror. The
-pedantic and -pedantic-errors flags are _not_ set.
cpp(lib)is emitting warnings of the form:
form.h:330:8: warning: extra tokens at end of #endif directive
and _isn't_ causing them to be errors.
It looks like this is because those are issued via cpp_pedwarn(),
which in the end only causes an error out of pedantic_errors is set.
Comparing this with the behaviour of 'gcc' (or at least, a few stop
checks of its source 8-), it looks like GCC only calls pedwarn() in
places guarded by a check of pedantic. Then, pedwarn() itself forces
an error of pedantic_errors (-pedantic-errors) is set, and the common
error handling code called by pedwarn() forces a warning to be
'upgraded' in all cases if warnings_are_errors (-Werror) is set.
I'd expect that cpp would behave in approximately the same way. (The
nature of the error, i.e. whether or not that error should only show
up with -pedantic or not, is a different question. Personally i'd
prefer if it was enabled, but...)
it looks like there are a bunch of calls in cpp to cpp_pedwarn() which
aren't guaded with checks of the CPP pedantic flag. (but, there are
at least some calls which are guarded...)
So, I guess the question is, what's the expected behaviour in CPP, and
is this a known issue, and what's the Right solution?
chris