public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/33143]  New: preprocess should ignore trigraphs in /* */ comments
@ 2007-08-22  0:34 mec at google dot com
  2007-08-22  0:36 ` [Bug preprocessor/33143] " mec at google dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mec at google dot com @ 2007-08-22  0:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Warning-Options.html#Warning-Options-Wtrigraphs

-Wtrigraphs
    Warn if any trigraphs are encountered that might change the meaning of the
program (trigraphs within comments are not warned about). This warning is
enabled by -Wall. 

Right now, trigraphs in // comments are not warned about.  Trigraphs in /* */
comments are warned about, but should not be.  Trigraphs in #if 0 ... #endif
are also warned about, but it would probably be too sticky to change that
behavior.

Example:

mec@hollerith:~/exp-trigraph$ cat z1.cc
#if 0
??-??-
#endif

/*
??-??-
 */

// ??-??-

mec@hollerith:~/exp-trigraph$ /home/mec/gcc-4.2.1/install/bin/g++ -E z1.cc
# 1 "z1.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "z1.cc"
z1.cc:2:1: warning: trigraph ??- ignored, use -trigraphs to enable
z1.cc:2:4: warning: trigraph ??- ignored, use -trigraphs to enable

mec@hollerith:~/exp-trigraph$ /home/mec/gcc-4.3-20070810/install/bin/g++ -E
z1.cc
# 1 "z1.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "z1.cc"
z1.cc:2:1: warning: trigraph ??- ignored, use -trigraphs to enable
z1.cc:2:4: warning: trigraph ??- ignored, use -trigraphs to enable


-- 
           Summary: preprocess should ignore trigraphs in /* */ comments
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec at google dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
@ 2007-08-22  0:36 ` mec at google dot com
  2007-08-22  0:37 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mec at google dot com @ 2007-08-22  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from mec at google dot com  2007-08-22 00:35 -------
Created an attachment (id=14093)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14093&action=view)
C++ source file with trigraphs in comments and #if 0


-- 


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
  2007-08-22  0:36 ` [Bug preprocessor/33143] " mec at google dot com
@ 2007-08-22  0:37 ` pinskia at gcc dot gnu dot org
  2007-08-22  1:13 ` joseph at codesourcery dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-22  0:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-08-22 00:37 -------
> Trigraphs in #if 0 ... #endif
No that is correct to warn in that context as text inside #if 0 ... #endif are
supposed to be tokens.

Now in multiple line comments, they should not be warned about.


-- 


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
  2007-08-22  0:36 ` [Bug preprocessor/33143] " mec at google dot com
  2007-08-22  0:37 ` pinskia at gcc dot gnu dot org
@ 2007-08-22  1:13 ` joseph at codesourcery dot com
  2008-04-04 16:29 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2007-08-22  1:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from joseph at codesourcery dot com  2007-08-22 01:13 -------
Subject: Re:  preprocess should ignore trigraphs in
 /* */ comments

On Wed, 22 Aug 2007, pinskia at gcc dot gnu dot org wrote:

> Now in multiple line comments, they should not be warned about.

Unless of course they affect whether the comment ends or not.  That is,

/* ... *??/
/

where the comment ends only if trigraphs are enabled.


-- 


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
                   ` (2 preceding siblings ...)
  2007-08-22  1:13 ` joseph at codesourcery dot com
@ 2008-04-04 16:29 ` tromey at gcc dot gnu dot org
  2008-04-04 16:36 ` mec at google dot com
  2008-04-04 16:40 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-04-04 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tromey at gcc dot gnu dot org  2008-04-04 16:28 -------
I tried this test case and as far as I can tell it works as expected.
Can you say what you think is wrong?

I thought perhaps you were misreading the error output.  The errors
from the initial report are:

z1.cc:2:1: warning: trigraph ??- ignored, use -trigraphs to enable
z1.cc:2:4: warning: trigraph ??- ignored, use -trigraphs to enable

These are both on line 2.  So, we aren't emitting a warning for
the trigraph in the comment.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
                   ` (3 preceding siblings ...)
  2008-04-04 16:29 ` tromey at gcc dot gnu dot org
@ 2008-04-04 16:36 ` mec at google dot com
  2008-04-04 16:40 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mec at google dot com @ 2008-04-04 16:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mec at google dot com  2008-04-04 16:36 -------
Doh!  You are right, I was confused when I read "z1.cc:2:4" as an error on line
4. Both errors are in line 2, inside the #if block.  Sorry for the noise.


-- 

mec at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug preprocessor/33143] preprocess should ignore trigraphs in /* */ comments
  2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
                   ` (4 preceding siblings ...)
  2008-04-04 16:36 ` mec at google dot com
@ 2008-04-04 16:40 ` tromey at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-04-04 16:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tromey at gcc dot gnu dot org  2008-04-04 16:39 -------
It is no trouble.  Thanks.


-- 


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


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

end of thread, other threads:[~2008-04-04 16:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-22  0:34 [Bug preprocessor/33143] New: preprocess should ignore trigraphs in /* */ comments mec at google dot com
2007-08-22  0:36 ` [Bug preprocessor/33143] " mec at google dot com
2007-08-22  0:37 ` pinskia at gcc dot gnu dot org
2007-08-22  1:13 ` joseph at codesourcery dot com
2008-04-04 16:29 ` tromey at gcc dot gnu dot org
2008-04-04 16:36 ` mec at google dot com
2008-04-04 16:40 ` tromey 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).