This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/70518] Conditional compilation of #line directives


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]