public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
       [not found] <200101020654.WAA03344@neosilicon.transmeta.com>
@ 2001-01-01 23:00 ` Linus Torvalds
  2001-01-02  0:23   ` Fergus Henderson
  2001-01-02  9:18   ` Joe Buck
  0 siblings, 2 replies; 21+ messages in thread
From: Linus Torvalds @ 2001-01-01 23:00 UTC (permalink / raw)
  To: gcc

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

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-01 23:00 ` Trigraph warnings when compiling linux-2.4.0-prerelease1 Linus Torvalds
@ 2001-01-02  0:23   ` Fergus Henderson
  2001-01-02  9:18   ` Joe Buck
  1 sibling, 0 replies; 21+ messages in thread
From: Fergus Henderson @ 2001-01-02  0:23 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: gcc

On 01-Jan-2001, Linus Torvalds <torvalds@transmeta.com> wrote:
> 
> Joe Buck  <jbuck@racerx.synopsys.com> wrote:
> >
> >[someone wrote:]
> >> 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.

Well, it's a non-portability.  You may consider the Linux kernel's
dependence on GNU C to be a feature, but I think many consider it an
undesirable one.

> >Please direct complaints to the ANSI C committee for inflicting this
> >trigraphs botch on us all.
> 
> The ANSI C committee doesn't care.

I'm skeptical about that.

I think it would be more productive if you turned the flame-o-meter
down a few notches.

Cheers,
	Fergus.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-01 23:00 ` Trigraph warnings when compiling linux-2.4.0-prerelease1 Linus Torvalds
  2001-01-02  0:23   ` Fergus Henderson
@ 2001-01-02  9:18   ` Joe Buck
  2001-01-02 10:38     ` Linus Torvalds
  1 sibling, 1 reply; 21+ messages in thread
From: Joe Buck @ 2001-01-02  9:18 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: gcc

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

Well, at least, it's not a serious one.  And if you want to claim that
the kernel is not written in C, but rather in a language dialect called,
say, gcc258, it's not a bug.
 
> Get your facts straight before you start acting like a language lawyer.

It's more important to alert users that their code may malfunction if
they compile it with a different compiler than to produce a warning-free
compile of the Linux kernel.  It's a tradeoff.  The kernel is only one
program.

If we suddenly refused to compile the code, or changed documented behavior
of the output code, you would have a complaint.  Since we don't, either
fix your code or live with the warning.  The fix is trivial.  But we
reserve the right to add new warnings from time to time.  My personal view
is that the compiler should not emit a warning if that warning cannot be
silenced by the user without making the code worse, even if some style
guru recommends it.  That's because such a warning leads people to make
worse code.  But that doesn't apply in this circumstance.  We SHOULD warn
for non-portable constructs, and this is one.  Otherwise we'll get bug
reports later.

As for the rest of your insults, I've deleted them.  BTW, Linus, you sent
this message twice, once just to me, so you're seeing two replies.  If you
feel the need to insult me further, please use private mail, as personal
abuse is not acceptable conduct on the gcc development list.


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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02  9:18   ` Joe Buck
@ 2001-01-02 10:38     ` Linus Torvalds
  2001-01-02 10:58       ` Joe Buck
  0 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2001-01-02 10:38 UTC (permalink / raw)
  To: Joe Buck; +Cc: gcc

On Tue, 2 Jan 2001, Joe Buck wrote:

> > >> 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.
> 
> Well, at least, it's not a serious one.  And if you want to claim that
> the kernel is not written in C, but rather in a language dialect called,
> say, gcc258, it's not a bug.

Ehh..

The compiler is called "gcc", and is invoced as such.

And you apparently entirely dismissed the fact that the Linux behaviour is
based on _documented_ behaviour. And you still want to call it a "bug".

> It's more important to alert users that their code may malfunction if
> they compile it with a different compiler than to produce a warning-free
> compile of the Linux kernel.  It's a tradeoff.  The kernel is only one
> program.

The kernel may be one program, but point me to a _single_ program that
uses trigraphs. Show me _one_ serious program that wants to use them.

The fact is, nobody uses trigraphs. NOBODY. They were a bad idea.

But hey, as good as you are at ignoring documentation, I'm sure you'll
have no trouble at all ignoring reality too.

		Linus

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 10:38     ` Linus Torvalds
@ 2001-01-02 10:58       ` Joe Buck
  2001-01-02 11:15         ` Linus Torvalds
  0 siblings, 1 reply; 21+ messages in thread
From: Joe Buck @ 2001-01-02 10:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: gcc

> The kernel may be one program, but point me to a _single_ program that
> uses trigraphs. Show me _one_ serious program that wants to use them.

It is the very fact that no one wants to use trigraphs that means it's
appropriate to alert the user when s/he accidentally constructs one.  It's
only a warning.  Ignore it if you want.  If it makes you happy, I'll
retract my claim that it's a bug, if you have, or want to add the
requirement that no one ever use the -ansi switch when compiling the
kernel.

> But hey, as good as you are at ignoring documentation, I'm sure you'll
> have no trouble at all ignoring reality too.

Wow.  Can't you have a disagreement without making it so personal?  The
documentation promised that the string "??)" would be interpreted as "??)"
by default and as "]" if -ansi is given, and so it is.  No promise has
been broken.  I write portable software for a living, and my code has
to compile with gcc as well as with a variety of other compilers.  I
want to be alerted if I mess up in this way, before a customer complains.
If the price of that is to have Linus Torvalds insult me once in a while,
so be it.



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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 10:58       ` Joe Buck
@ 2001-01-02 11:15         ` Linus Torvalds
  2001-01-02 11:50           ` Per Bothner
  0 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2001-01-02 11:15 UTC (permalink / raw)
  To: Joe Buck; +Cc: gcc

On Tue, 2 Jan 2001, Joe Buck wrote:
> 
> > But hey, as good as you are at ignoring documentation, I'm sure you'll
> > have no trouble at all ignoring reality too.
> 
> Wow.  Can't you have a disagreement without making it so personal?  The
> documentation promised that the string "??)" would be interpreted as "??)"
> by default and as "]" if -ansi is given, and so it is.  No promise has
> been broken.

It's your calling it a "bug" that I object to, and that I found so damn
obnoxious. 

Linux uses a _lot_ of gcc extensions. This one happens to be one of the
better documented ones, in fact. More documented than the inline assembly
syntax etc stuff has historically been - the use of some of those features
was originally based largely on reading gcc sources because they were so
badly documented (and don't take this as a complaint - they're much better
documented now, and I can't afford to complain about other peoples lack of
documentation anyway as I'm personally not very good at documenting stuff
myself).

However, it's still the case that the gcc documentation actually implies
that gcc should not even _warn_ about trigraphs: the documentation I have
says:

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

Now, that doesn't mean that gcc people can't change their minds,
obviously. It may be that the documentation has been fixed up to match the
new behaviour too. I'm not saying that documentation and features can't be
changed. That's obviously fine, and often required by progress.

But what is NOT fine is to then complain about people that follow the
documentation as it used to be. That really gets my hackles up. I can
change the kernel sources, that's not the problem. But I don't want to
hear some holier-than-thou lecture from the prophet of ANSI about how the
kernel was bad just because the gcc documentation was changed from under
it.

		Linus

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 11:15         ` Linus Torvalds
@ 2001-01-02 11:50           ` Per Bothner
  2001-01-02 11:55             ` Linus Torvalds
                               ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Per Bothner @ 2001-01-02 11:50 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: gcc

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.

I read "assuming they are enabled" is a very poor way of saying "warn about
constructs that would be read as trigraphs if trigraphs were enabled."

(This question is of course separate from whether -Wtrigraphs should be
on by default or implied other switches like -Wall.  I think -Wtrigraphs
should definitely be implied by -Wall, though probably not default.)
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 11:50           ` Per Bothner
@ 2001-01-02 11:55             ` Linus Torvalds
  2001-01-02 12:40               ` Joe Buck
  2001-01-02 14:50             ` Toon Moene
  2001-01-03 23:39             ` Zack Weinberg
  2 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2001-01-02 11:55 UTC (permalink / raw)
  To: Per Bothner; +Cc: gcc

On 2 Jan 2001, Per Bothner wrote:
> 
> I read "assuming they are enabled" is a very poor way of saying "warn about
> constructs that would be read as trigraphs if trigraphs were enabled."

I would have to agree that that would be more logical, even if I don't
think that is what the docs actually _say_ right now ;)

		Linus

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 11:55             ` Linus Torvalds
@ 2001-01-02 12:40               ` Joe Buck
  2001-01-02 13:50                 ` Linus Torvalds
  0 siblings, 1 reply; 21+ messages in thread
From: Joe Buck @ 2001-01-02 12:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Per Bothner, gcc

Per Bothner wrote:
> > I read "assuming they are enabled" is a very poor way of saying "warn about
> > constructs that would be read as trigraphs if trigraphs were enabled."

Linus wrote:
> I would have to agree that that would be more logical, even if I don't
> think that is what the docs actually _say_ right now ;)

Thanks for alerting us to this documentation bug.  I had also read the
language the way Per reads it, and not the way you read it, but I agree
that it is confusing and the fact that it can be read two ways means it's
bad documentation.  If the compiler worked the way you are interpreting
the documentation, the warning would be less useful, and the intent of
-Wtrigraphs is to warn about trigraphs.

Trigraphs are handled during preprocessing, and we have a new
preprocessor, so some differences are going to show up.  I will object
to changes that have a negative impact on users (e.g. the Emacs users
and #cpu), but this is not such a case IMHO.




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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 12:40               ` Joe Buck
@ 2001-01-02 13:50                 ` Linus Torvalds
  0 siblings, 0 replies; 21+ messages in thread
From: Linus Torvalds @ 2001-01-02 13:50 UTC (permalink / raw)
  To: Joe Buck; +Cc: Per Bothner, gcc

On Tue, 2 Jan 2001, Joe Buck wrote:
> Per Bothner wrote:
> > > I read "assuming they are enabled" is a very poor way of saying "warn about
> > > constructs that would be read as trigraphs if trigraphs were enabled."
> 
> Linus wrote:
> > I would have to agree that that would be more logical, even if I don't
> > think that is what the docs actually _say_ right now ;)
> 
> Thanks for alerting us to this documentation bug.  I had also read the
> language the way Per reads it, and not the way you read it,

It did not use to be a documentation bug, and the way I read the
documentation is the _right_ way to read it.

It is 

 (a) what the meaning of the English was (as opposed to what you and Per
     apparently _expected_ it to be, and what I can agree is to some
     degree the "logical" warning message)

and

 (b) what the old cccp.c sources actually did. 

So my reading of the documentation was/is the right one: gcc did not use
to warn about trigraphs if trigraphs were not enabled. That's what the
documentation says, and that is what the code says. There is no "bug"
anywhere. It was obviously intentional, and probably because a lot of
people hated trigraphs with a passion. 

These days, trigraphs have been around so long that some people seem to
have forgotten just how despised they used to be, and just take the dang
things at face value. 

The fact is that apparently the new pre-processor behaves differently than
the old one, and differently from the documentation. Fine. If people
really want the new behaviour (I personally don't particularly, but I'm
not in a position to argue about _that_), just fix the documentation.

But let's also admit that this is new behaviour, instead of saying that
things were "buggy", ok? 

		Linus

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 11:50           ` Per Bothner
  2001-01-02 11:55             ` Linus Torvalds
@ 2001-01-02 14:50             ` Toon Moene
  2001-01-03 23:39             ` Zack Weinberg
  2 siblings, 0 replies; 21+ messages in thread
From: Toon Moene @ 2001-01-02 14:50 UTC (permalink / raw)
  To: Per Bothner; +Cc: Linus Torvalds, gcc

Per Bothner wrote:

> Linus Torvalds <torvalds@transmeta.com> writes:

> >        -Wtrigraphs
> >               Warn if any trigraphs are encountered (assuming they are enabled).

> I read "assuming they are enabled" is a very poor way of saying "warn about
> constructs that would be read as trigraphs if trigraphs were enabled."

Note how much of the actual meaning of the sentence is elided by the
formulation in the documentation - these sort of sentences are hard to
read and easy to misunderstand for non-native speakers, e.g. "are
encountered" vs. "would be read as".  In fact, I read it exactly the
same way Linus did (once I managed to wrap my head around the notion of
"trigraphs" :-( )

[ Use Fortran 77 - only 48 legal characters :-)]

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 11:50           ` Per Bothner
  2001-01-02 11:55             ` Linus Torvalds
  2001-01-02 14:50             ` Toon Moene
@ 2001-01-03 23:39             ` Zack Weinberg
  2 siblings, 0 replies; 21+ messages in thread
From: Zack Weinberg @ 2001-01-03 23:39 UTC (permalink / raw)
  To: Linus Torvalds, gcc

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

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 19:03 ` Fergus Henderson
@ 2001-01-03 11:21   ` Joe Buck
  0 siblings, 0 replies; 21+ messages in thread
From: Joe Buck @ 2001-01-03 11:21 UTC (permalink / raw)
  To: Fergus Henderson; +Cc: dewar, torvalds, gcc, per

On 02-Jan-2001, dewar@gnat.com <dewar@gnat.com> wrote:
> > In fact the current documentation is clear and appears to match the
> > documentation.

Fergus Henderson writes:
> I'm not quite sure what you mean there (did you intend to say
> "appears to match the implementation"?).
> 
> The current documentation says
> 
> `-Wtrigraphs'
>      Warn if any trigraphs are encountered that might change the
>      meaning of the program (trigraphs within comments are not warned
>      about).
> 
> which is different to the documentation quoted earlier in this
> thread.  I agree that it seems clear enough.

Linus was talking about the documentation for the most recently
released compiler (the manual shipped with 2.95.2), not the manual
in the snapshots.

(This is just for clarification, I'm not going to continue the argument).

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 13:27 dewar
  2001-01-02 15:20 ` Joe Buck
@ 2001-01-02 19:03 ` Fergus Henderson
  2001-01-03 11:21   ` Joe Buck
  1 sibling, 1 reply; 21+ messages in thread
From: Fergus Henderson @ 2001-01-02 19:03 UTC (permalink / raw)
  To: dewar; +Cc: jbuck, torvalds, gcc, per

On 02-Jan-2001, dewar@gnat.com <dewar@gnat.com> wrote:
> 
> In fact the current documentation is clear and appears to match the
> documentation.

I'm not quite sure what you mean there (did you intend to say
"appears to match the implementation"?).

The current documentation says

`-Wtrigraphs'
     Warn if any trigraphs are encountered that might change the
     meaning of the program (trigraphs within comments are not warned
     about).

which is different to the documentation quoted earlier in this
thread.  I agree that it seems clear enough.

> It is certainly reasonable to ask the question of
> whether the warning should be effective even if trigraphs are enabled,

I think that if you use `-Wtrigraphs', you should get the warnings
regardless of whether trigraph substitution is enabled or not.
That is the current behaviour, and matches the current documentation.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-02 13:27 dewar
@ 2001-01-02 15:20 ` Joe Buck
  2001-01-02 19:03 ` Fergus Henderson
  1 sibling, 0 replies; 21+ messages in thread
From: Joe Buck @ 2001-01-02 15:20 UTC (permalink / raw)
  To: dewar; +Cc: torvalds, gcc, per

> <<Thanks for alerting us to this documentation bug.> >>
> 
> Boy, Joe, you really love the word bug don't you?

I deliberately use it more often than some others do.  If something isn't
the way that it should be, I think we should admit it and use the "bug"
word.  Otherwise we all sound like Bill Gates claiming that Microsoft
software had no bugs.

The language is poorly chosen for either intended meaning.

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
@ 2001-01-02 13:27 dewar
  2001-01-02 15:20 ` Joe Buck
  2001-01-02 19:03 ` Fergus Henderson
  0 siblings, 2 replies; 21+ messages in thread
From: dewar @ 2001-01-02 13:27 UTC (permalink / raw)
  To: jbuck, torvalds; +Cc: gcc, per

<<Thanks for alerting us to this documentation bug.
>>

Boy, Joe, you really love the word bug don't you?

In fact the current documentation is clear and appears to match the
documentation. It is certainly reasonable to ask the question of
whether the warning should be effective even if trigraphs are enabled,
but running around shouting "BUG" is not the best policy here :-)

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
@ 2001-01-02 12:05 dewar
  0 siblings, 0 replies; 21+ messages in thread
From: dewar @ 2001-01-02 12:05 UTC (permalink / raw)
  To: per, torvalds; +Cc: gcc

<<I read "assuming they are enabled" is a very poor way of saying "warn about
constructs that would be read as trigraphs if trigraphs were enabled."
>>

I think it is a very good way of saying "assuming they are enabled" :-)

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
@ 2001-01-02  9:26 dewar
  0 siblings, 0 replies; 21+ messages in thread
From: dewar @ 2001-01-02  9:26 UTC (permalink / raw)
  To: jbuck, torvalds; +Cc: gcc

<<Well, at least, it's not a serious one.  And if you want to claim that
the kernel is not written in C, but rather in a language dialect called,
say, gcc258, it's not a bug.
>>

The name of the language is GNU C, and it is perfectly reasonable for
GNU tools and related software to be written in this language. The only
tools that really need to stay with in the confines of traditional C 
(ANSI C is already too large) are the compiler itself, so that everything
can be bootstrapped.

But there is really no interest in compiling the kernel with some other
compiler other than the gcc GNU C compiler as far as I can see.

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-01  9:56 Rich Baum
  2001-01-01 11:50 ` Tim Hollebeek
@ 2001-01-01 15:16 ` Joe Buck
  1 sibling, 0 replies; 21+ messages in thread
From: Joe Buck @ 2001-01-01 15:16 UTC (permalink / raw)
  To: richbaum; +Cc: gcc

> 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 (?]

for the last line, since ??) is the trigraph for ].  Many C compilers
other than gcc will just print that and never tell you there's a problem.

By default, gcc disables trigraphs, but if you give the -ansi flag
they are enabled.  But it warns about inputs that give different behavior
with and without trigraphs.

> them?  I felt this would be the appropriate list to send this to since 
> it compiles without these warnings with egcs-1.1.2.

You just found a bug in egcs-1.1.2 then.

The kernel should be changed, to, for example

> line 938: 	printk("imm: bad interrupt (??\?)\n");

Please direct complaints to the ANSI C committee for inflicting this
trigraphs botch on us all.

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

* Re: Trigraph warnings when compiling linux-2.4.0-prerelease1
  2001-01-01  9:56 Rich Baum
@ 2001-01-01 11:50 ` Tim Hollebeek
  2001-01-01 15:16 ` Joe Buck
  1 sibling, 0 replies; 21+ messages in thread
From: Tim Hollebeek @ 2001-01-01 11:50 UTC (permalink / raw)
  To: richbaum; +Cc: gcc

Rich Baum writes ...
> 
> line 1278: 	DEVICE(109e,036c,"Bt879(??) Video Capture")

I always use:

?\?

and comment why.  "?\?)" isn't a trigraph, so the warnings should disappear.

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

* Trigraph warnings when compiling linux-2.4.0-prerelease1
@ 2001-01-01  9:56 Rich Baum
  2001-01-01 11:50 ` Tim Hollebeek
  2001-01-01 15:16 ` Joe Buck
  0 siblings, 2 replies; 21+ messages in thread
From: Rich Baum @ 2001-01-01  9:56 UTC (permalink / raw)
  To: gcc

I get the following warnings when compiling the latest linux kernel 
with the 20001225 gcc snapshot:

gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-
prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -
mpreferred-stack-boundary=2 -march=k6    -c -o names.o names.c
In file included from names.c:38:
devlist.h:1278:33: warning: trigraph ??) ignored
devlist.h:6370:25: warning: trigraph ??) ignored
In file included from names.c:44:
devlist.h:1278:33: warning: trigraph ??) ignored
devlist.h:6370:25: warning: trigraph ??) ignored
In file included from names.c:50:
devlist.h:1278:33: warning: trigraph ??) ignored
devlist.h:6370:25: warning: trigraph ??) ignored

gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-
prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -
mpreferred-stack-boundary=2 -march=k6 -DMODULE -
DMODVERSIONS -include 
/usr/src/linux/include/linux/modversions.h   -c -o imm.o imm.c
imm.c:929:37: warning: trigraph ??) ignored
imm.c:938:38: 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");

From looking at the code it is apparent to me that the authors of 
these files meant to print the string ??) and not the character ].  Is 
there a possible fix to remove these warnings or should I just ignore 
them?  I felt this would be the appropriate list to send this to since 
it compiles without these warnings with egcs-1.1.2.

Rich.

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

end of thread, other threads:[~2001-01-03 23:39 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200101020654.WAA03344@neosilicon.transmeta.com>
2001-01-01 23:00 ` Trigraph warnings when compiling linux-2.4.0-prerelease1 Linus Torvalds
2001-01-02  0:23   ` Fergus Henderson
2001-01-02  9:18   ` Joe Buck
2001-01-02 10:38     ` Linus Torvalds
2001-01-02 10:58       ` Joe Buck
2001-01-02 11:15         ` Linus Torvalds
2001-01-02 11:50           ` Per Bothner
2001-01-02 11:55             ` Linus Torvalds
2001-01-02 12:40               ` Joe Buck
2001-01-02 13:50                 ` Linus Torvalds
2001-01-02 14:50             ` Toon Moene
2001-01-03 23:39             ` Zack Weinberg
2001-01-02 13:27 dewar
2001-01-02 15:20 ` Joe Buck
2001-01-02 19:03 ` Fergus Henderson
2001-01-03 11:21   ` Joe Buck
  -- strict thread matches above, loose matches on Subject: below --
2001-01-02 12:05 dewar
2001-01-02  9:26 dewar
2001-01-01  9:56 Rich Baum
2001-01-01 11:50 ` Tim Hollebeek
2001-01-01 15:16 ` Joe Buck

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