This is the mail archive of the gcc@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]

Re: Warning for trigraphs in comment?


Paul Koning <pkoning@equallogic.com> writes:

>  >> Would it make sense to have the lexer ignore trigraphs (i.e., just
>  >> treat ??/ as three characters) unless specifically enabled with
>  >> -fenable-trigraphs?  In the unlikely case that anyone actually
>  >> uses trigraphs, this would enable them to continue doing so.
>
>  Zack> GCC has done this for decades.  See the documentation of the
>  Zack> -trigraphs option.
>
> Oh.  So it looks like what's needed is to have -ansi NOT imply
> -trigraphs.

We can't do that.  It would violate user expectations that -ansi
puts GCC in fully conforming mode.  I should point out here that
GCC's default ignoring of trigraphs is controversial in some circles;
suggest you read through some back issues of comp.std.c.


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> What is happening with current GCC in production use is that GCC
> choosed NOT to warn for trigraphs in comment even if -Wtrigraph. 

Correct, because the common case of such trigraphs is

  /* some text (???) */

which obviously cannot affect the meaning of the program.  You're
right that ??/\n can change a comment boundary; Neil and I knew that
this was a potential issue but we decided not to worry about it until
it came up, which has now happened, and we've addressed it.

zw


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