bug-bison
[Top][All Lists]
Advanced

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

Re: Error compiling bison 3.4.2 on Solaris


From: Paul Eggert
Subject: Re: Error compiling bison 3.4.2 on Solaris
Date: Sun, 20 Oct 2019 12:45:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 10/20/19 5:04 AM, Akim Demaille wrote:

I still believe the warning is valid.  Annoying, but valid.

Sure, just as a compiler that said "warning: semicolon present in the source code" for each semicolon would be annoying-but-valid. (Semicolons are dangerous! Think how much safer your C program will be if you omit semicolons! :-)

However, the question is not whether the warning is *valid*; it's whether the warning is *useful*. And when the warning is about code that is doing portable and reliable integer overflow checking (as is the case here), a compiler that in essence is saying "watch out! the code is trying to do portable and reliable integer overflow checking!" is harmful, not useful.

And therefore I would prefer to have intprops.h use pragmas to disable it 
locally.

I'd rather not. Newer compilers are doing their jobs better in this area, and we should not worry about pacifying older compilers as it's considerably more trouble than it's worth. Instead, we should simply suggest that builders who employ older or buggy compilers should not use --enable-gcc-warnings.

But of course we can disable the warning for bison, and not the test suite, as 
below.  It fixes the issues with GCC, but not yet with old clangs (3.3 and 3.4).

Yes, that is a good fix - it's more targeted than the one I proposed.

To pacify old Clangs, you can add "-Wno-tautological-constant-out-of-range-compare" as well. That's what Coreutils does.

To give you a preview of future problems you might run into with Clang, here are some other Clang flags that Coreutils and other GCC projects have found useful:

-Wno-tautological-compare
-Wno-switch
-Wno-pointer-sign
-Wno-string-plus-int
-Wno-unknown-attributes
-Wno-initializer-overrides

Emacs also adds "-Wno-null-pointer-arithmetic" on the somewhat-controversial grounds that ((char *)0 == (char *)0 + 0) is true everywhere even if the C standard doesn't require it (Emacs relies on this for its pointer tagging).

Of course Bison should add these other flags only if needed.



reply via email to

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