This is the mail archive of the gcc@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]

escaped newline handling


It was suggested to bring this issue up here. I was told that the
current, non-standard conforming way of hanlding escaped newlines in the
preprocessor is deliberate. However, in PR/5735 I suggested to make
standard conforming behavior the default and support the current
behavior via command line switch.

The issue is with the backslash and the newline characters being
interspersed by whitespace. It was correctly pointed out that this leads
to a warning that cannot be suppressed when outside of a comment, and in
this I cannot see a valid, standard-conforming construct that breaks
(certainly, constructs that would lead to other errors would not yield
the expected results, which could still be an issue if the preprocessor
is used to process things other than C[++] code). However, in the case
of a single line comment, the is different. Not only is the original
warning being suppressed in this case (and a different warning being
issued), but in a single line comment that uses the backslash to, say,
illustrate something (as in
// comment  \/
// using    |
// some     |
// graphics /\ 
void test() {
}
) code that is standard-conforming will break (in the example, the
first token seen following the comments will be the closing brace).

Thank you for considering changing this behavior,
Jan


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