public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment
@ 2004-05-19  4:12 doug at cs dot dartmouth dot edu
  2004-05-19  4:38 ` [Bug preprocessor/15519] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: doug at cs dot dartmouth dot edu @ 2004-05-19  4:12 UTC (permalink / raw)
  To: gcc-bugs

In both 3.3.1 (cygwin, NT) and 3.2.2 (redhat, linux) the preprocessor
silently--and wrongly--eats the declaration below, where $ marks
have been placed to show the end of lines.  The comment was carefully
written to avoid the very misbehavior that it elicited.
To exhibit the trouble, remove the $ marks and compile with
g++ -pedantic -E

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

-- 
           Summary: preprocessor mistreats backslash-blank-newline in //
                    comment
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doug at cs dot dartmouth dot edu
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: I can't guess what a "triplet" is


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug preprocessor/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
@ 2004-05-19  4:38 ` bangerth at dealii dot org
  2004-05-19  4:42 ` [Bug c++/15519] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-05-19  4:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |preprocessor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
  2004-05-19  4:38 ` [Bug preprocessor/15519] " bangerth at dealii dot org
@ 2004-05-19  4:42 ` pinskia at gcc dot gnu dot org
  2004-05-19  4:43 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-19  4:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-18 15:39 -------
I cannot reproduce this with released versions of 3.2.2, 3.2.3, 3.3.3, or 3.4.0 (or the mainline of gcc).

Are you sure that you can reproduce it with the given example.

I get for 3.3.x and below:
pr15519.cc:3: syntax error at end of input
For 3.4.0 and above:
pr15519.cc:2: error: expected constructor, destructor, or type conversion at end of input
pr15519.cc:2: error: expected `,' or `;' at end of input

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
          Component|preprocessor                |c++


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
  2004-05-19  4:38 ` [Bug preprocessor/15519] " bangerth at dealii dot org
  2004-05-19  4:42 ` [Bug c++/15519] " pinskia at gcc dot gnu dot org
@ 2004-05-19  4:43 ` pinskia at gcc dot gnu dot org
  2004-05-19  5:11 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-19  4:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-18 15:42 -------
Woops I missed the sentence that says "remove the $ marks".

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
                   ` (2 preceding siblings ...)
  2004-05-19  4:43 ` pinskia at gcc dot gnu dot org
@ 2004-05-19  5:11 ` pinskia at gcc dot gnu dot org
  2004-05-19  7:55 ` [Bug preprocessor/15519] " zack at codesourcery dot com
  2004-09-08 17:28 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-19  5:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-18 15:42:43
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug preprocessor/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
                   ` (3 preceding siblings ...)
  2004-05-19  5:11 ` pinskia at gcc dot gnu dot org
@ 2004-05-19  7:55 ` zack at codesourcery dot com
  2004-09-08 17:28 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: zack at codesourcery dot com @ 2004-05-19  7:55 UTC (permalink / raw)
  To: gcc-bugs


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug preprocessor/15519] preprocessor mistreats backslash-blank-newline in // comment
  2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
                   ` (4 preceding siblings ...)
  2004-05-19  7:55 ` [Bug preprocessor/15519] " zack at codesourcery dot com
@ 2004-09-08 17:28 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-08 17:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-08 17:28 -------
See 8270.

*** This bug has been marked as a duplicate of 8270 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15519


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-08 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-19  4:12 [Bug c++/15519] New: preprocessor mistreats backslash-blank-newline in // comment doug at cs dot dartmouth dot edu
2004-05-19  4:38 ` [Bug preprocessor/15519] " bangerth at dealii dot org
2004-05-19  4:42 ` [Bug c++/15519] " pinskia at gcc dot gnu dot org
2004-05-19  4:43 ` pinskia at gcc dot gnu dot org
2004-05-19  5:11 ` pinskia at gcc dot gnu dot org
2004-05-19  7:55 ` [Bug preprocessor/15519] " zack at codesourcery dot com
2004-09-08 17:28 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).