[Mesa-dev] glcpp's handling of #elif with no expression

Matt Turner mattst88 at gmail.com
Mon Nov 26 14:46:52 PST 2012


Carl,

Here's the write-up of what I was seeing earlier today for my own record.

#if 1
#elif
#endif

gives "0:2(1): preprocessor warning: ignoring illegal #elif without
expression". gcc rejects it, but glcpp just warns since #if is true
and it doesn't need to evaluate #elif's nonexistent expression.

Switching #if 1 to #if 0 correctly gives "0:2(1): preprocessor error:
#elif with no expression".

Due to how skipping works, we have to pass the #elif tokens to the
parser, leading to situations like:

#if 0
# if 1
# elif
# endif
#endif

which still gives the warning message.

Matt


More information about the mesa-dev mailing list