This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
- To: gcc at gcc dot gnu dot org
- Subject: Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
- From: Linus Torvalds <torvalds at transmeta dot com>
- Date: Mon, 1 Jan 2001 23:00:15 -0800 (PST)
In article <200101012315.PAA08380@racerx.synopsys.com>,
Joe Buck <jbuck@racerx.synopsys.com> wrote:
>
>> I get the following warnings when compiling the latest linux kernel
>> with the 20001225 gcc snapshot:
>...
>> devlist.h:1278:33: warning: trigraph ??) ignored
>...
>> The lines are as follows:
>> devlist.h:
>> line 1278: DEVICE(109e,036c,"Bt879(??) Video Capture")
>> line 6370: VENDOR(2a15,"3D Vision(???)")
>>
>> imm.c:
>> line 929: printk("imm: parity error (???)\n");
>> line 938: printk("imm: bad interrupt (???)\n");
>
>This is a kernel bug. That is, a strict ISO C compiler
>must print
>
>imm: bad interrupt (?]
This is NOT a kernel bug.
Get your facts straight before you start acting like a language lawyer.
Check out the gcc documentation for the last five years, and possibly
longer. The gcc documentation explicitly stats (or at least used to
state) that trigraphs are only enabled when "-ansi" is used.
The gcc documentation also correctly states that trigraphs are a (and I
quote) "undesirable and rarely used ANSI feature".
In short, the kernel is absolutely and 100% _correct_ in assuming that
trigraphs will not be expanded by gcc. It's a _documented feature_ of
the compiler. It has also been documented that the warning is enabled
by "-Wtrigraphs", which makes perfect sense (ie "don't bother sane
people with insane warnings").
Enabling the warning by default is obnoxious, and is against historical
gcc documentation. It should be enabled only when "-ansi" is enabled or
when asked for, and should have the reverse meaning, ie something like
devlist.h: 1278:33: warning: trigraph ??) translates as ]. Did you really mean that?
And before you as a language lawyer complain that trigraphs are part of
ANSI C and as such should not cause warnings when used as such, get your
facts straight _again_.
A conforming compiler is perfectly allowed to warn about pretty much
anything it wants to, and modern compilers are even _expected_ to warn
about certain perfectly legal constructs. For example, if you have the
strictly conforming program
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
if (i = argc)
printf("I got arguments\n");
return 0;
}
then most people expect the warning about using an assignment as a truth
value. Even though it is perfectly valid and strictly conforming C.
>Please direct complaints to the ANSI C committee for inflicting this
>trigraphs botch on us all.
The ANSI C committee doesn't care.
However, I would hope that the gcc maintainers WOULD care about a
well-documented gcc extension that has been around for as long as I can
remember, and that they would ignore your rant about ANSI features. Gcc
without the "-ansi" flag is _not_ a ANSI compiler, and has never even
been mean to be one, as explicitly stated in the documentation.
As such, your arguments about trigraphs and ANSI are utterly specious.
Your pointer to go complain to the ANSI committee is bogus and uncalled
for. Unlike you, others have read and understood gcc documentation.
Every single sane person pretty much agrees that trigraphs are stupid.
They are documented as such in gcc.
So don't force sane people that know about the issue to write uglier
code just because of them.
And don't call programs that follow the documentation buggy.
Linus