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]

Re: Trigraph warnings when compiling linux-2.4.0-prerelease1


On Tue, Jan 02, 2001 at 11:51:45AM -0800, Per Bothner wrote:
> Linus Torvalds <torvalds@transmeta.com> writes:
> 
> >     -Wtrigraphs
> >          Warn if any trigraphs are encountered (assuming they are enabled).
> > 
> > which certainly implies to me that even if you enabled "-Wtrigraphs", it
> > wouldn't even't cause a warning if trigraphs aren't enabled (and again,
> > it's documented that they are enabled by "-ansi" and by "-trigraphs" and
> > disabled by default).
> 
> That is not my reading of the documentation, nor I think what it
> intended to say. It clearly is silly that -Wtrigraphs would have no
> effect if trigraphs are disabled - you might still want the warning to
> catch cases of unintended trigraphs being miscompiled by other
> compilers.

Historically (with cccp; that's GCC <= 2.95.x for most people) you got
the trigraph warnings only if you put both -Wtrigraphs (or -Wall) and
-trigraphs.  In other words, Linus' reading matches the behavior of
the program for all current official releases of GCC.  I decided when
I started working on cpplib that the trigraph warning should be active
even when trigraph conversion was off.  This has been in place for a
long time, but with different semantics depending on which snapshot
you have.  Redhat's 2.96, if I remember correctly, warns about them
inside comments; current 2.97 snapshots don't.

For user space code, this has in fact been found to be useful.  There
exist C compilers whose only behavior is to silently convert
trigraphs, and some of them are relatively popular.  The example I
know about is DEC/Compaq's C compiler for Alphas.  There's a fair
number of people who want to compile the same code with both GCC and
that compiler.

Current documentation, as pointed out downthread, has been clarified.
I would be open to discussion of whether -Wtrigraphs should be in
-Wall.  On the one hand, it is a rare problem.  On the other, it is
easy to silence the warning, and hard to find the problem if you've
never heard of trigraphs.

You could easily throw -Wno-trigraphs into the kernel Makefiles; that
option has been recognized by GCC since before 2.7.2.

zw

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