public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-03 23:26 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-05-03 23:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Cc: gcc-gnats@gcc.gnu.org, Zack Weinberg <zack@codesourcery.com>
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 4 May 2003 00:22:21 +0100

 Hallvard B Furuseth wrote:-
 
 > 	Gcc *silently* compiles code like `puts("??!")' incorrectly: It
 > 	prints `??!' instead of `|'.  I agree that not converting
 > 	trigraphs is the best default, they are most likely programmer
 > 	errors.  However, fixing a programmer error without telling the
 > 	programmer is very bad, we'll test our code and think it's
 > 	correct when it will misbehave with other (correct) compilers.
 
 That would be OK with me.  What do you think, Zack?  There's always
 -Wno-trigraphs for those who don't want it.
 
 > 	Turn on -Wtrigraphs by default, maybe except if -trigraphs is
 > 	given.  (I suggest to do so even if -ansi is given, since they
 > 	are still probably programmer bugs, but that's less important.)
 > 
 > 	BTW, I suggest moving the detailed description of trigraphs from
 > 	Info node (gcc)Preprocessor Options to (gcc)C Dialect Options or
 > 	to a separate node.  They may technically fit better where they
 > 	are now, but people are more likely to look at the latter nodes.
 > 	And you might add that the fix for unintended trigraphs in string
 > 	literals is to split them up from "??!" to "?" "?!".
 
 Escaping the 2nd '?' works too.
 
 Neil.


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 21:36 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-05-04 21:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Zack Weinberg <zack@codesourcery.com>
Cc: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>, gcc-gnats@gcc.gnu.org,
	gcc-patches@gcc.gnu.org
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 4 May 2003 22:33:20 +0100

 Zack Weinberg wrote:-
 
 > > This option is in effect unless trigraphs are turned on, and is
 > > implied by @option{-Wall}.  With the exception of a trigraph that
 > > would form an escaped newline, warnings are not given for trigraphs
 > > within comments as they do not affect the meaning of the program.
 > 
 > is confusing.  I would say instead
 > 
 >   Most trigraphs in comments cannot affect the meaning of the program.
 >   However, a trigraph that would form an escaped newline (@samp{??/}
 >   at the end of a line) can, by changing where the comment begins or
 >   ends.  Therefore, only trigraphs that would form escaped newlines
 >   produce warnings inside a comment.
 > 
 >   This option is implied by @option{-Wall}.  If @option{-Wall} is not
 >   given, this option is still enabled unless trigraphs are enabled.
 >   To get trigraph conversion without warnings, but get the other
 >   @option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
 
 That's great, thanks, I'll plagiarise in full.
 
 Neil.


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 20:56 Zack Weinberg
  0 siblings, 0 replies; 10+ messages in thread
From: Zack Weinberg @ 2003-05-04 20:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>,  gcc-gnats@gcc.gnu.org,
	  gcc-patches@gcc.gnu.org
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 04 May 2003 13:55:35 -0700

 Neil Booth <neil@daikokuya.co.uk> writes:
 
 > This is a patch for preprocessor/10613 and preprocessor/10614.  We warn
 > about trigraphs, unless an explicit -trigraphs (or -std implying
 > -trigraphs) is given.  -Wall still implies -Wtrigraphs.
 
 Looks good.  The only thing I have to say is that this bit of
 documentation
 
 > This option is in effect unless trigraphs are turned on, and is
 > implied by @option{-Wall}.  With the exception of a trigraph that
 > would form an escaped newline, warnings are not given for trigraphs
 > within comments as they do not affect the meaning of the program.
 
 is confusing.  I would say instead
 
   Most trigraphs in comments cannot affect the meaning of the program.
   However, a trigraph that would form an escaped newline (@samp{??/}
   at the end of a line) can, by changing where the comment begins or
   ends.  Therefore, only trigraphs that would form escaped newlines
   produce warnings inside a comment.
 
   This option is implied by @option{-Wall}.  If @option{-Wall} is not
   given, this option is still enabled unless trigraphs are enabled.
   To get trigraph conversion without warnings, but get the other
   @option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
 
 zw


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 20:06 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-05-04 20:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	Zack Weinberg <zack@codesourcery.com>
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 4 May 2003 21:00:17 +0100

 This is a patch for preprocessor/10613 and preprocessor/10614.  We warn
 about trigraphs, unless an explicit -trigraphs (or -std implying
 -trigraphs) is given.  -Wall still implies -Wtrigraphs.
 
 Further, we want about trigraphs that imply an escaped newline sequence
 in a comment, but no other trigraphs in a comment are warned about.
 This is a good enough approximation to the "warn about a trigraph iff
 it changes the meaning of the program" rule.
 
 Tests included.  Tested on NetBSD-x86.
 
 Neil.
 
 	* cppinit.c (cpp_create_reader, post_options): Warn about
 	trigraphs unless explicity set or -trigraphs.
 	* cpplex.c (warn_in_comment): New.
 	(_cpp_process_line_notes): Better handling of -Wtrigraphs.
 	(_cpp_skip_block_comment): Add call to _cpp_process_line_notes.
 	* doc/cppopts.texi, doc/cpp.texi: Update.
 testsuite:
 	* gcc.dg/cpp/Wtrigraphs.c: Update.
 	* gcc.dg/cpp/Wtrigraphs-2.c: New tests.
 
 Index: cppinit.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
 retrieving revision 1.276
 diff -u -p -r1.276 cppinit.c
 --- cppinit.c	19 Apr 2003 00:22:48 -0000	1.276
 +++ cppinit.c	4 May 2003 19:56:49 -0000
 @@ -149,6 +149,7 @@ cpp_create_reader (lang, table)
    CPP_OPTION (pfile, show_column) = 1;
    CPP_OPTION (pfile, tabstop) = 8;
    CPP_OPTION (pfile, operator_names) = 1;
 +  CPP_OPTION (pfile, warn_trigraphs) = 2;
    CPP_OPTION (pfile, warn_endif_labels) = 1;
    CPP_OPTION (pfile, warn_deprecated) = 1;
    CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99);
 @@ -553,6 +554,9 @@ post_options (pfile)
        pfile->state.prevent_expansion = 1;
        CPP_OPTION (pfile, traditional) = 0;
      }
 +
 +  if (CPP_OPTION (pfile, warn_trigraphs) == 2)
 +    CPP_OPTION (pfile, warn_trigraphs) = !CPP_OPTION (pfile, trigraphs);
  
    if (CPP_OPTION (pfile, traditional))
      {
 Index: cpplex.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cpplex.c,v
 retrieving revision 1.233
 diff -u -p -r1.233 cpplex.c
 --- cpplex.c	26 Apr 2003 21:03:51 -0000	1.233
 +++ cpplex.c	4 May 2003 19:56:49 -0000
 @@ -63,6 +63,7 @@ static void save_comment PARAMS ((cpp_re
  				  cppchar_t));
  static void create_literal PARAMS ((cpp_reader *, cpp_token *, const uchar *,
  				    unsigned int, enum cpp_ttype));
 +static bool warn_in_comment PARAMS ((cpp_reader *, _cpp_line_note *));
  static int name_p PARAMS ((cpp_reader *, const cpp_string *));
  static cppchar_t maybe_read_ucn PARAMS ((cpp_reader *, const uchar **));
  static tokenrun *next_tokenrun PARAMS ((tokenrun *));
 @@ -180,6 +181,36 @@ _cpp_clean_line (pfile)
    buffer->next_line = s + 1;
  }
  
 +/* Return true if the trigraph indicated by NOTE should be warned
 +   about in a comment.  */
 +static bool
 +warn_in_comment (pfile, note)
 +     cpp_reader *pfile;
 +     _cpp_line_note *note;
 +{
 +  const uchar *p;
 +
 +  /* Within comments we don't warn about trigraphs, unless the
 +     trigraph forms an escaped newline, as that may change
 +     behaviour.  */
 +  if (note->type != '/')
 +    return false;
 +
 +  /* If -trigraphs, then this was an escaped newline iff the next note
 +     is coincident.  */
 +  if (CPP_OPTION (pfile, trigraphs))
 +    return note[1].pos == note->pos;
 +
 +  /* Otherwise, see if this forms an escaped newline.  */
 +  p = note->pos + 3;
 +  while (is_nvspace (*p))
 +    p++;
 +
 +  /* There might have been escaped newlines between the trigraph and the
 +     newline we found.  Hence the position test.  */
 +  return (*p == '\n' && p < note[1].pos);
 +}
 +
  /* Process the notes created by add_line_note as far as the current
     location.  */
  void
 @@ -219,7 +250,8 @@ _cpp_process_line_notes (pfile, in_comme
  	}
        else if (_cpp_trigraph_map[note->type])
  	{
 -	  if (!in_comment && CPP_OPTION (pfile, warn_trigraphs))
 +	  if (CPP_OPTION (pfile, warn_trigraphs)
 +	      && (!in_comment || warn_in_comment (pfile, note)))
  	    {
  	      if (CPP_OPTION (pfile, trigraphs))
  		cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
 @@ -284,6 +316,7 @@ _cpp_skip_block_comment (pfile)
  	}
      }
  
 +  _cpp_process_line_notes (pfile, true);
    return false;
  }
  
 Index: testsuite/gcc.dg/cpp/Wtrigraphs-2.c
 ===================================================================
 RCS file: testsuite/gcc.dg/cpp/Wtrigraphs-2.c
 diff -N testsuite/gcc.dg/cpp/Wtrigraphs-2.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ testsuite/gcc.dg/cpp/Wtrigraphs-2.c	4 May 2003 19:56:49 -0000
 @@ -0,0 +1,20 @@
 +/* { dg-do preprocess } */
 +/* { dg-options "-std=c99 -Wtrigraphs -fno-show-column" } */
 +
 +/* Test we don't double warn for trigraphs immediately after preceding
 +   text.  Source Neil Booth.  4 May 2003.  */
 +
 +/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in
 +   { dg-warning "converted" } some ??/
 +   { dg-bogus "ignored" } ??< comments.  */
 +
 +// { dg-bogus "ignored" } More ??/ comment ??> tests.
 +
 +// { dg-warning "converted" } Another ??/
 +   Test
 +
 +// { dg-warning "converted" } And another with space after ??/  
 +   the escape
 +
 +// { dg-bogus "ignored" } A tricky one ??/\
 +
 Index: testsuite/gcc.dg/cpp/Wtrigraphs.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c,v
 retrieving revision 1.1
 diff -u -p -r1.1 Wtrigraphs.c
 --- testsuite/gcc.dg/cpp/Wtrigraphs.c	22 Nov 2000 20:37:44 -0000	1.1
 +++ testsuite/gcc.dg/cpp/Wtrigraphs.c	4 May 2003 19:56:49 -0000
 @@ -1,5 +1,5 @@
  /* { dg-do preprocess } */
 -/* { dg-options "-Wtrigraphs -fno-show-column" } */
 +/* { dg-options "-std=gnu99 -Wtrigraphs -fno-show-column" } */
  
  /* Test we don't double warn for trigraphs immediately after preceding
     text.  Source Neil Booth.  22 Nov 2000.  */
 @@ -7,3 +7,21 @@
  abcdef??<			/* { dg-warning "ignored" } */
  123456??>			/* { dg-warning "ignored" } */
  +??=				/* { dg-warning "ignored" } */
 +
 +/* Test we warn of escaped newlines only in comments.  Source Neil
 +   Booth.  4 May 2003.  */
 +
 +/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in
 +   { dg-warning "ignored" } some ??/
 +   { dg-bogus "ignored" } ??< comments.  */
 +
 +// { dg-bogus "ignored" } More ??/ comment ??> tests.
 +
 +// { dg-warning "ignored" } Another ??/
 +   Test
 +
 +// { dg-warning "ignored" } And another with space after ??/  
 +   the escape
 +
 +// { dg-bogus "ignored" } A tricky one ??/\
 +
 Index: doc/cpp.texi
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/doc/cpp.texi,v
 retrieving revision 1.54
 diff -u -p -r1.54 cpp.texi
 --- doc/cpp.texi	12 Mar 2003 20:30:05 -0000	1.54
 +++ doc/cpp.texi	4 May 2003 19:56:51 -0000
 @@ -293,16 +293,18 @@ obsolete systems that lack some of C's p
  example, @samp{??/} stands for @samp{\}, so @t{'??/n'} is a character
  constant for a newline.
  
 -Trigraphs are not popular and many compilers implement them incorrectly.
 -Portable code should not rely on trigraphs being either converted or
 -ignored.  If you use the @option{-Wall} or @option{-Wtrigraphs} options,
 -GCC will warn you when a trigraph would change the meaning of your
 -program if it were converted.
 +Trigraphs are not popular and many compilers implement them
 +incorrectly.  Portable code should not rely on trigraphs being either
 +converted or ignored.  With @option{-Wtrigraphs} GCC will warn you
 +when a trigraph may change the meaning of your program if it were
 +converted.  @xref{Wtrigraphs}.
  
 -In a string constant, you can prevent a sequence of question marks from
 -being confused with a trigraph by inserting a backslash between the
 -question marks.  @t{"(??\?)"} is the string @samp{(???)}, not
 -@samp{(?]}.  Traditional C compilers do not recognize this idiom.
 +In a string constant, you can prevent a sequence of question marks
 +from being confused with a trigraph by inserting a backslash between
 +the question marks, or by separating the string literal at the
 +trigraph and making use of string literal concatenation.  @t{"(??\?)"}
 +is the string @samp{(???)}, not @samp{(?]}.  Traditional C compilers
 +do not recognize these idioms.
  
  The nine trigraphs and their replacements are
  
 Index: doc/cppopts.texi
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/doc/cppopts.texi,v
 retrieving revision 1.18
 diff -u -p -r1.18 cppopts.texi
 --- doc/cppopts.texi	16 Mar 2003 10:37:06 -0000	1.18
 +++ doc/cppopts.texi	4 May 2003 19:56:51 -0000
 @@ -69,10 +69,12 @@ use @option{-o} to specify the output fi
  
  @item -Wall
  @opindex Wall
 -Turns on all optional warnings which are desirable for normal code.  At
 -present this is @option{-Wcomment} and @option{-Wtrigraphs}.  Note that
 -many of the preprocessor's warnings are on by default and have no
 -options to control them.
 +Turns on all optional warnings which are desirable for normal code.
 +At present this is @option{-Wcomment}, @option{-Wtrigraphs},
 +@option{-Wmultichar} and a warning about integer promotion causing a
 +change of sign in @code{#if} expressions.  Note that many of the
 +preprocessor's warnings are on by default and have no options to
 +control them.
  
  @item -Wcomment
  @itemx -Wcomments
 @@ -84,10 +86,13 @@ comment, or whenever a backslash-newline
  
  @item -Wtrigraphs
  @opindex Wtrigraphs
 -Warn if any trigraphs are encountered.  This option used to take effect
 -only if @option{-trigraphs} was also specified, but now works
 -independently.  Warnings are not given for trigraphs within comments, as
 -they do not affect the meaning of the program.
 +@anchor{Wtrigraphs}
 +Warn if any trigraphs that may change the meaning of a program are
 +encountered.  This option is in effect unless trigraphs are turned on,
 +and is implied by @option{-Wall}.  With the exception of a trigraph
 +that would form an escaped newline, warnings are not given for
 +trigraphs within comments as they do not affect the meaning of the
 +program.
  
  @item -Wtraditional
  @opindex Wtraditional


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 20:05 neil
  0 siblings, 0 replies; 10+ messages in thread
From: neil @ 2003-05-04 20:05 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, h.b.furuseth, nobody

Synopsis: Please make -Wtrigraphs the default

State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Sun May  4 20:05:05 2003
State-Changed-Why:
    Behaviour changed in 3.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10613


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 10:06 Hallvard B Furuseth
  0 siblings, 0 replies; 10+ messages in thread
From: Hallvard B Furuseth @ 2003-05-04 10:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
To: neil@gcc.gnu.org,
    gcc-bugs@gcc.gnu.org,
    gcc-prs@gcc.gnu.org,
    h.b.furuseth@usit.uio.no,
    nobody@gcc.gnu.org,
    gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 4 May 2003 11:56:26 +0200

 neil@gcc.gnu.org writes:
 
 >     -Wall implies -Wtrigraphs.  Zack and I, the active CPP
 >     maintainers, feel this is enough, but that we're willing to add it
 >     to be on by default to gauge the response.
 >     
 >     Is -Wall not enough for you?
 
 No.  -Wall would be enough if -trigraphs was turned on by default, or if
 trigrahs where syntax errors by default.  My problem is that code
 _silently_ compiles differently on gcc with standard options and on an
 ISO C compiler.  This is very different from normal gcc extensions,
 where the code won't compile at all on an ISO C compilers - then one
 certainly notices the difference.
 
 -- 
 Hallvard


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04 10:06 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-05-04 10:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Cc: neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sun, 4 May 2003 10:59:02 +0100

 Hallvard B Furuseth wrote:-
 
 > No.  -Wall would be enough if -trigraphs was turned on by default, or if
 > trigrahs where syntax errors by default.  My problem is that code
 > _silently_ compiles differently on gcc with standard options and on an
 > ISO C compiler.  This is very different from normal gcc extensions,
 > where the code won't compile at all on an ISO C compilers - then one
 > certainly notices the difference.
 
 OK, I'll prepare a patch for 3.4 where -Wtrigraphs is on by default.
 However, if there are complaints I will revert it to -Wall only, since
 that is the long-standing behaviour.
 
 Neil.


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04  9:40 neil
  0 siblings, 0 replies; 10+ messages in thread
From: neil @ 2003-05-04  9:40 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, h.b.furuseth, nobody

Synopsis: Please make -Wtrigraphs the default

State-Changed-From-To: open->analyzed
State-Changed-By: neil
State-Changed-When: Sun May  4 09:40:37 2003
State-Changed-Why:
    -Wall implies -Wtrigraphs.  Zack and I, the active CPP maintainers, feel this is enough, but that we're willing to add it to be on by default to gauge the response.
    
    Is -Wall not enough for you?

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10613


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

* Re: preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-04  1:16 Zack Weinberg
  0 siblings, 0 replies; 10+ messages in thread
From: Zack Weinberg @ 2003-05-04  1:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/10613; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>,  gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/10613: Please make -Wtrigraphs the default
Date: Sat, 03 May 2003 18:13:57 -0700

 Neil Booth <neil@daikokuya.co.uk> writes:
 
 > Hallvard B Furuseth wrote:-
 >
 >> 	Gcc *silently* compiles code like `puts("??!")' incorrectly: It
 >> 	prints `??!' instead of `|'.  I agree that not converting
 >> 	trigraphs is the best default, they are most likely programmer
 >> 	errors.  However, fixing a programmer error without telling the
 >> 	programmer is very bad, we'll test our code and think it's
 >> 	correct when it will misbehave with other (correct) compilers.
 >
 > That would be OK with me.  What do you think, Zack?  There's always
 > -Wno-trigraphs for those who don't want it.
 
 This is one of a *lot* of warnings that GCC issues only at -Wall,
 which indicate a bug with >90% confidence.  So I don't think there
 is anything wrong with the status quo; however, I would not object
 to enabling this warning by default.  We could do it experimentally
 in 3.4 and see how many people complain.
 
 The suggested documentation change is a good idea.
 
 zw


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

* preprocessor/10613: Please make -Wtrigraphs the default
@ 2003-05-03 23:16 Hallvard B Furuseth
  0 siblings, 0 replies; 10+ messages in thread
From: Hallvard B Furuseth @ 2003-05-03 23:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10613
>Category:       preprocessor
>Synopsis:       Please make -Wtrigraphs the default
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat May 03 23:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hallvard B Furuseth
>Release:        3.2.3
>Organization:
University of Oslo
>Environment:
System: SunOS bombur.uio.no 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.2.3/configure --enable-languages=c,c++,f77 --disable-shared --disable-multilib --prefix=/usit/bombur/hbf --enable-version-specific-runtime-libs --enable-threads
>Description:
	Gcc *silently* compiles code like `puts("??!")' incorrectly: It
	prints `??!' instead of `|'.  I agree that not converting
	trigraphs is the best default, they are most likely programmer
	errors.  However, fixing a programmer error without telling the
	programmer is very bad, we'll test our code and think it's
	correct when it will misbehave with other (correct) compilers.
>How-To-Repeat:
	int main() { puts("??!"); return 0; }
>Fix:
	Turn on -Wtrigraphs by default, maybe except if -trigraphs is
	given.  (I suggest to do so even if -ansi is given, since they
	are still probably programmer bugs, but that's less important.)

	BTW, I suggest moving the detailed description of trigraphs from
	Info node (gcc)Preprocessor Options to (gcc)C Dialect Options or
	to a separate node.  They may technically fit better where they
	are now, but people are more likely to look at the latter nodes.
	And you might add that the fix for unintended trigraphs in string
	literals is to split them up from "??!" to "?" "?!".
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-05-04 21:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-03 23:26 preprocessor/10613: Please make -Wtrigraphs the default Neil Booth
  -- strict thread matches above, loose matches on Subject: below --
2003-05-04 21:36 Neil Booth
2003-05-04 20:56 Zack Weinberg
2003-05-04 20:06 Neil Booth
2003-05-04 20:05 neil
2003-05-04 10:06 Neil Booth
2003-05-04 10:06 Hallvard B Furuseth
2003-05-04  9:40 neil
2003-05-04  1:16 Zack Weinberg
2003-05-03 23:16 Hallvard B Furuseth

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