[Top][All Lists]

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

bug#23640: 25.1.50; Getting rid of compiler warnings

From: Paul Eggert
Subject: bug#23640: 25.1.50; Getting rid of compiler warnings
Date: Mon, 30 May 2016 16:29:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

Ken Brown wrote:
Why not just unconditionally initialize the variables that gcc complains about?

That could make the code harder to understand. Someone who sees "int i = 0;" can reasonably infer that the 0 is needed, i.e., that a later part of the code needs the 0. Someone who sees "int i IF_LINT (= 0);" should be under no such illusion.

The tradition of hijacking the symbol 'lint' for GCC purposes has been used for many years in several GNU packages. As the problem you mention affects only optionally-generated warnings on non-GNU platforms, I suspect nobody has cared until now about the issue. Anyway, I changed Emacs master to use the symbol GCC_LINT instead; this should avoid the collision in names. Please give it a try.

The FreeBSD and Cygwin uses of 'lint' violate the C Standard. For example:

#define lint 1
#include <stdio.h>
_Noreturn int x;

This program violates a constraint so the C Standard requires a compile-time diagnostic, but from what you say on FreeBSD and Cygwin the compiler misbehaves and silently ignores the _Noreturn. I see that HBBroeker is independently making a similar point on the Cygwin mailing list <https://www.cygwin.com/ml/cygwin/2016-05/msg00405.html>.

reply via email to

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