Z
zaimoni
This is a test case I constructed for a vaporware standalone C99
preprocessor:
#if 1
#elif
#endif
The text did not permit quickly deciding whether the syntax relaxation
for preprocessing directives in blocks that aren't processed (C99 6.10
paragraph 4) dominates knowing what an elif-block actually was (C99
6.10 paragraph 1). If 6.10 paragraph 4 dominates, this should warn
(as the preprocessor got lucky). If C99 6.10 paragraph 1 dominates,
this should error.
The obvious complementary test case
#if 0
#elif
#endif
must error, as the control expression of the #elif is actually
needed. So I tentatively decided to make the first test case behave
like the obvious one: error [why should it only warn just because we
got lucky?].
When I ran my test suite against GCC's cpp, the first test case only
warned. Since this is a legitimate implementation: did I miss
something that guarantees that the syntax relaxation dominates knowing
that the elif-block is well-formed?
preprocessor:
#if 1
#elif
#endif
The text did not permit quickly deciding whether the syntax relaxation
for preprocessing directives in blocks that aren't processed (C99 6.10
paragraph 4) dominates knowing what an elif-block actually was (C99
6.10 paragraph 1). If 6.10 paragraph 4 dominates, this should warn
(as the preprocessor got lucky). If C99 6.10 paragraph 1 dominates,
this should error.
The obvious complementary test case
#if 0
#elif
#endif
must error, as the control expression of the #elif is actually
needed. So I tentatively decided to make the first test case behave
like the obvious one: error [why should it only warn just because we
got lucky?].
When I ran my test suite against GCC's cpp, the first test case only
warned. Since this is a legitimate implementation: did I miss
something that guarantees that the syntax relaxation dominates knowing
that the elif-block is well-formed?