Re: [PATCH][RFC] Sparc: Remove trigraph in die_if_kernel()message.

From: Jesper Juhl
Date: Fri Jun 10 2011 - 03:59:47 EST


On Thu, 9 Jun 2011, David Miller wrote:

> From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Date: Fri, 10 Jun 2011 00:03:22 +0100
>
> > On Thu, Jun 09, 2011 at 03:59:43PM -0700, David Miller wrote:
> >> > If I'm not mistaken, that "??!" will be taken as a trigraph for "|" by the
> >> > preprocessor, so the final string will end up either as
> >> > "Penguin instruction from Penguin mode|?!"
> >
> > Not without -trigraphs, which is not on by default...
>
> Oh, in that case I'll rever this.
>

Well, my gcc warns about it. It seems that -Wtrigraphs is enabled by
default:

[jj@dragon src]$ gcc --version
gcc (GCC) 4.6.0 20110603 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

[jj@dragon src]$ cat test.c
#include <stdio.h>

int main()
{
printf("Penguin instruction from Penguin mode??!?!");
return 0;
}
[jj@dragon src]$ gcc test.c
test.c: In function ʽmainʼ:
test.c:5:48: warning: trigraph ??! ignored, use -trigraphs to enable [-Wtrigraphs]


Which was why I wrote in my original submission mail :

"... which I assume is not what we want, or as the correct string but with
a warning about an ignored trigraph which I assume we don't want either."

So either we get the wrong string (if someone enables -trigraphs) or we
get a warning (at least with newer gcc's). Which is why I felt the patch
made sense as a way to avoid both unfortunate results.

--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.