Unknown preprocessor directives

Zack Weinberg weinberg@cygnus.com
Fri Jun 30 17:31:00 GMT 2000


On Fri, Jun 30, 2000 at 03:01:25PM -0700, Mark Mitchell wrote:
> 
> I typed `#iF' in some code (instead of `#if').  I was confused when I
> saw this message:
> 
>   foo.c:9190: unbalanced `#endif'
> 
> It would have been easier for me if this had said "Hey, numbskull,
> watch your typing; there's no such thing as `#iF'."  Is it reasonable
> to have the preprocessor issue a warning in this case?

In the development tree, it already does:

$ cat x.c
#iF 1
#endif
$ ./cpp x.c /dev/null
x.c:1:1: invalid preprocessing directive #iF
x.c:2:6: #endif without #if
$

cccp didn't used to generate a diagnostic for bogus directives, and I
suspect you're using it since your error message has no column number.
However, in 2.95, cc1 *would* generate that diagnostic; were you using -E?

zw


More information about the Gcc-bugs mailing list