help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling Reverse Polish Calculator Example


From: Akim Demaille
Subject: Re: Compiling Reverse Polish Calculator Example
Date: Wed, 31 Oct 2012 16:46:59 +0100

Le 31 oct. 2012 à 16:25, Paul Eggert a écrit :

> On 10/31/2012 01:32 AM, Akim Demaille wrote:
>> I now also realize that maybe Bison should ignore these
>> BOM bytes.  Or even propagate them to the generated files?
> 
> I guess it'd be OK to ignore them but I wouldn't propagate them,
> as they're trouble.

GIGO principle :)  but ok.  That's what GCC and Clang do
for \0 (but they don't see \0 at the same point :).

$ LC_ALL=C clang-mp-3.2 /tmp/foo.c
/tmp/foo.c:1:1: warning: null character ignored [-Wnull-character]
^
1 warning generated.
$ LC_ALL=C gcc-mp-4.8 /tmp/foo.c
/tmp/foo.c:1:1: warning: null character(s) ignored [enabled by default]
 
 ^

> While we're on the subject of UTF-8, is Bison really
> generating messages like this?
> 
> rpcalc.y:1.1: invalid character: `\377'
> 
> It should be using apostrophes, like this:
> 
> rpcalc.y:1.1: invalid character: '\377'
> 
> The GNU Coding Standards changed recently, in this matter.

The user is using Bison 2.3, more recent versions of Bison have
followed the evolution, thanks to quotearg.

Octal does not look cute, but that's the choice gcc made too
in the error message.  Clang seems to be more readable on this
regard.

$ printf '\000\001\n' > foo.c
$ LC_ALL=C gcc-mp-4.8 /tmp/foo.c
/tmp/foo.c:1:1: warning: null character(s) ignored [enabled by default]
/tmp/foo.c:1:2: error: stray '\1' in program
$ LC_ALL=C clang-mp-3.2 /tmp/foo.c
/tmp/foo.c:1:1: warning: null character ignored [-Wnull-character]
^
/tmp/foo.c:1:2: error: expected identifier or '('
<U+0000><U+0001>
        ^
1 warning and 1 error generated.

nul is ignored, the others are errors.


BTW, Paul, did you see my question about quotearg in this very thread?

http://lists.gnu.org/archive/html/help-bison/2012-10/msg00017.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]