This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/70518] Conditional compilation of #line directives
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Apr 2016 17:05:30 +0000
- Subject: [Bug preprocessor/70518] Conditional compilation of #line directives
- Auto-submitted: auto-generated
- References: <bug-70518-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70518
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Sun, 3 Apr 2016, elyk03 at gmail dot com wrote:
> Should #line be processed unconditionally? I know the preprocessor has to keep
It should not be processed in skipped blocks. See C11 6.10.1#6: "Each
directiveâs condition is checked in order. If it evaluates to false
(zero), the group that it controls is skipped: directives are processed
only through the name that determines the directive in order to keep track
of the level of nested conditionals; the rest of the directivesâ
preprocessing tokens are ignored, as are the other preprocessing tokens in
the group.".
This means, for example, that
#if 0
#line invalid line directive
#endif
is valid, whereas that #line directive would not be valid outside #if 0.