Compare commits

...
4 Commits
Author SHA1 Message Date
Joel E. Denny b2bc8a1ba0 Version 2.5.
* NEWS (2.5): Set date.
2011-05-14 18:14:52 -04:00
Joel E. Denny 77bb73e7af 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.
2011-05-14 16:26:11 -04:00
Joel E. Denny 9d6af15318 Fix precedence for end token.
Since Bison 2.3b, which restored the ability of precedence
directives to assign user token numbers, doing so for user token
number 0 has produced an assertion failure.
* NEWS (2.5): Document fix.
* src/symtab.c (symbol_user_token_number_set): In the case of the
end token, don't decrement ntokens if it was never incremented.
* tests/regression.at (Token number in precedence declaration):
Extend.
2011-05-01 22:20:15 -04:00
Joel E. Denny 441735026b Prepare for 2.5 release.
* NEWS (2.5_rc1): Rename back to...
(2.5): ... this, and unset date.
2011-05-01 18:41:34 -04:00
8 changed files with 80 additions and 20 deletions
+40
View File
@@ -1,3 +1,43 @@
2011-05-14 Joel E. Denny <[email protected]>
Version 2.5.
* NEWS (2.5): Set date.
2011-05-14 Joel E. Denny <[email protected]>
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.
2011-05-01 Joel E. Denny <[email protected]>
Fix precedence for end token.
Since Bison 2.3b, which restored the ability of precedence
directives to assign user token numbers, doing so for user token
number 0 has produced an assertion failure.
* NEWS (2.5): Document fix.
* src/symtab.c (symbol_user_token_number_set): In the case of the
end token, don't decrement ntokens if it was never incremented.
* tests/regression.at (Token number in precedence declaration):
Extend.
2011-05-01 Joel E. Denny <[email protected]>
Prepare for 2.5 release.
* NEWS (2.5_rc1): Rename back to...
(2.5): ... this, and unset date.
2011-05-01 Joel E. Denny <[email protected]>
Version 2.5_rc1.
+12 -2
View File
@@ -1,7 +1,7 @@
Bison News
----------
* Changes in version 2.5_rc1 (2011-05-01):
* Changes in version 2.5 (2011-05-14):
** Grammar symbol names can now contain non-initial dashes:
@@ -334,7 +334,7 @@ Bison News
bison -Werror,none,yacc gram.y
*** The `none' category now disables all Bison warnings.
*** The `none' category now disables all Bison warnings:
Previously, the `none' category disabled only Bison warnings for
which there existed a specific -W/--warning category. However,
@@ -343,6 +343,16 @@ Bison News
bison -Wnone gram.y
** Precedence directives can now assign token number 0:
Since Bison 2.3b, which restored the ability of precedence
directives to assign token numbers, doing so for token number 0 has
produced an assertion failure. For example:
%left END 0
This bug has been fixed.
* Changes in version 2.4.3 (2010-08-05):
** Bison now obeys -Werror and --warnings=error for warnings about
-1
View File
@@ -84,7 +84,6 @@ if test "${enableval}" = yes; then
WARN_CFLAGS_TEST="$WARN_CFLAGS $WARN_CFLAGS_TEST"
AC_SUBST([WARN_CXXFLAGS_TEST])
AC_SUBST([WARN_CFLAGS_TEST])
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi
BISON_TEST_FOR_WORKING_C_COMPILER
+4 -4
View File
@@ -120,13 +120,13 @@ splice (\\[ \f\t\v]*\n)*
%%
%{
/* Nesting level of the current code in braces. */
int braces_level IF_LINT (= 0);
int braces_level PACIFY_CC (= 0);
/* Parent context state, when applicable. */
int context_state IF_LINT (= 0);
int context_state PACIFY_CC (= 0);
/* Location of most recent identifier, when applicable. */
location id_loc IF_LINT (= empty_location);
location id_loc PACIFY_CC (= empty_location);
/* Where containing code started, when applicable. Its initial
value is relevant only when yylex is invoked in the SC_EPILOGUE
@@ -135,7 +135,7 @@ splice (\\[ \f\t\v]*\n)*
/* Where containing comment or string or character literal started,
when applicable. */
boundary token_start IF_LINT (= scanner_cursor);
boundary token_start PACIFY_CC (= scanner_cursor);
%}
+1 -1
View File
@@ -58,7 +58,7 @@ static void fail_for_invalid_at (char const *at);
%%
%{
int out_lineno IF_LINT (= 0);
int out_lineno PACIFY_CC (= 0);
char *outname = NULL;
/* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and
+3 -2
View File
@@ -368,10 +368,11 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
if (user_token_number == 0)
{
endtoken = sym;
endtoken->number = 0;
/* It is always mapped to 0, so it was already counted in
NTOKENS. */
--ntokens;
if (endtoken->number != NUMBER_UNDEFINED)
--ntokens;
endtoken->number = 0;
}
}
+13 -7
View File
@@ -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. */
+7 -3
View File
@@ -1205,12 +1205,15 @@ AT_DATA_GRAMMAR([input.y],
%}
%error-verbose
%right END 0
%left TK1 1 TK2 2 "tok alias" 3
%%
start: TK1 sr_conflict "tok alias" ;
start:
TK1 sr_conflict "tok alias"
| start %prec END
;
sr_conflict:
TK2
| TK2 "tok alias"
@@ -1240,7 +1243,8 @@ main (void)
]])
AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
[[input.y:24.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias"
[[input.y:23.5-19: warning: rule useless in parser due to conflicts: start: start
input.y:27.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias"
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])