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/15519] preprocessor mistreats backslash-blank-newline in // comment


------- 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


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