diff options
author | Joel E. Denny <joeldenny@joeldenny.org> | 2011-05-14 16:16:26 -0400 |
---|---|---|
committer | Joel E. Denny <joeldenny@joeldenny.org> | 2011-05-14 16:26:11 -0400 |
commit | 77bb73e7af76ef5180b22c3b8355aaff1f498f68 (patch) | |
tree | 70d9a5f577a7d6f75fa59f3b0d14fe248393bdb6 /src/system.h | |
parent | 9d6af153184eea964fef7f87d76a60fe29f715b5 (diff) | |
download | bison-77bb73e7af76ef5180b22c3b8355aaff1f498f68.tar.gz |
Don't use IF_LINT in Bison sources.
It creates unnecessary differences between the sources that Bison
maintainers build and test (given that maintainers normally
configure with --enable-gcc-warnings) and the sources that Bison
users build. Instead, use PACIFY_CC, which doesn't. This change
fixes compiler warnings reported by Tys Lefering at
<http://lists.gnu.org/archive/html/bison-patches/2011-05/msg00004.html>.
* configure.ac: Don't AC_DEFINE lint regardless of the configure
options. This change affects imported gnulib sources, where
IF_LINT still appears and depends on lint.
* src/scan-gram.l, src/scan-skel.l: Replace uses of IF_LINT with
PACIFY_CC.
* src/system.h (IF_LINT): Remove cpp macro.
(PACIFY_CC): New cpp macro.
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/system.h b/src/system.h index 97a92257..13669a40 100644 --- a/src/system.h +++ b/src/system.h @@ -66,13 +66,19 @@ typedef size_t uintptr_t; | GCC extensions. | `-----------------*/ -/* Use this to suppress gcc's `...may be used before initialized' - warnings. */ -#ifdef lint -# define IF_LINT(Code) Code -#else -# define IF_LINT(Code) /* empty */ -#endif +/* Use PACIFY_CC to indicate that Code is unimportant to the logic of Bison + but that it is necessary for suppressing compiler warnings. For example, + Code might be a variable initializer that's always overwritten before the + variable is used. + + PACIFY_CC is intended to be useful only as a comment as it does not alter + Code. It is tempting to redefine PACIFY_CC so that it will suppress Code + when configuring without --enable-gcc-warnings. However, that would mean + that, for maintainers, Bison would compile with potentially less warnings + and safer logic than it would for users. Due to the overhead of M4, + suppressing Code is unlikely to offer any significant improvement in + Bison's performance anyway. */ +#define PACIFY_CC(Code) Code #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ |