This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/15519] preprocessor mistreats backslash-blank-newline in // comment
- From: "zack at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 16:17:13 -0000
- Subject: [Bug preprocessor/15519] preprocessor mistreats backslash-blank-newline in // comment
- References: <20040518153320.15519.doug@cs.dartmouth.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From zack at codesourcery dot com 2004-05-18 16:17 -------
Subject: Re: New: preprocessor mistreats
backslash-blank-newline in // comment
"doug at cs dot dartmouth dot edu" <gcc-bugzilla@gcc.gnu.org> writes:
> // boolean operation /\ $
> extern int band(int,int);$
>
> In some contexts g++ warns of the presence of backslash-space-newline,
> but not in comments. Under option -Wall, it reports a "multiline
> comment". The warnings do not, however, point out that the g++
> interpretation is nonstandard, even in -pedantic mode.
That's because it isn't nonstandard. It's the mapping of "end-of-line
indicators" in translation phase 1 (C99 5.1.1.2) -
Physical source file multibyte characters are mapped, in an
implementation-defined manner, to the source character set
(introducing new-line characters for end-of-line indicators)
The term "end-of-line indicator" is defined in section 5.2.1 as "In
source files, there shall be some way of indicating the end of each
line of text" - i.e. it's implementation-defined. GCC's definition of
an end-of-line indicator is "any number of horizontal whitespace
characters (space \t \v \f) followed by \n, \r\n, or \r".
Identical text to C99 5.1.1.2 appears in C++98 section 2.1
[lex.phases] - there doesn't seem to be a definition of "end-of-line
indicator" at all.
---
So, no, we're not going to make -pedantic care about this. However, a
patch to make the backslash-space-newline warning trigger within
comments when it will change the meaning of the program (and ONLY
then) would be welcome. Alternatively, the "multiline comment"
warning could be turned on by default.
zw
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519