mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
* configure.ac (AC_ARG_ENABLE): Use -Wextra -Wno-sign-compare
rather than -W, so we don't get bogus warnings about sign comparisons. Add -Wpointer-arith, since that warning is useful (it reports code that does not conform to C89 and that some compilers reject). * data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c: Undo latest change, since it's no longer needed.
This commit is contained in:
@@ -45,11 +45,12 @@ if test "${enableval}" = yes; then
|
|||||||
gl_WARNING_CFLAGS([-Werror])
|
gl_WARNING_CFLAGS([-Werror])
|
||||||
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
|
||||||
WARNING_CFLAGS=
|
WARNING_CFLAGS=
|
||||||
gl_WARNING_CFLAGS([-W])
|
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
|
||||||
gl_WARNING_CFLAGS([-Wall])
|
gl_WARNING_CFLAGS([-Wall])
|
||||||
gl_WARNING_CFLAGS([-Wcast-align])
|
gl_WARNING_CFLAGS([-Wcast-align])
|
||||||
gl_WARNING_CFLAGS([-Wcast-qual])
|
gl_WARNING_CFLAGS([-Wcast-qual])
|
||||||
gl_WARNING_CFLAGS([-Wformat])
|
gl_WARNING_CFLAGS([-Wformat])
|
||||||
|
gl_WARNING_CFLAGS([-Wpointer-arith])
|
||||||
gl_WARNING_CFLAGS([-Wwrite-strings])
|
gl_WARNING_CFLAGS([-Wwrite-strings])
|
||||||
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
|
||||||
# The following warnings are not suitable for C++.
|
# The following warnings are not suitable for C++.
|
||||||
|
|||||||
@@ -164,11 +164,6 @@ m4_define([b4_int_type],
|
|||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
# b4_safest_int_type
|
|
||||||
# ------------------
|
|
||||||
# The safest int type to cast to when it's necessary to compare a signed int
|
|
||||||
# type against an int type set by b4_int_type.
|
|
||||||
m4_define([b4_safest_int_type],[int])
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|||||||
12
data/glr.c
12
data/glr.c
@@ -1048,8 +1048,7 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
int* yyaction, const short int** yyconflicts)
|
int* yyaction, const short int** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yyindex < 0 || YYLAST < yyindex
|
if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||||
|| (]b4_safest_int_type[)yycheck[yyindex] != yytoken)
|
|
||||||
{
|
{
|
||||||
*yyaction = -yydefact[yystate];
|
*yyaction = -yydefact[yystate];
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
@@ -1071,8 +1070,7 @@ yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
|||||||
{
|
{
|
||||||
int yyr;
|
int yyr;
|
||||||
yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
||||||
if (0 <= yyr && yyr <= YYLAST
|
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
||||||
&& (]b4_safest_int_type[)yycheck[yyr] == yystate)
|
|
||||||
return yytable[yyr];
|
return yytable[yyr];
|
||||||
else
|
else
|
||||||
return yydefgoto[yylhs - YYNTOKENS];
|
return yydefgoto[yylhs - YYNTOKENS];
|
||||||
@@ -2122,8 +2120,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yyfmt = yystpcpy (yyformat, yyunexpected);
|
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if ((]b4_safest_int_type[)yycheck[yyx + yyn] == yyx
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||||
&& yyx != YYTERROR)
|
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
@@ -2219,8 +2216,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yyis_pact_ninf (yyj))
|
if (yyis_pact_ninf (yyj))
|
||||||
return;
|
return;
|
||||||
yyj += yytoken;
|
yyj += yytoken;
|
||||||
if (yyj < 0 || YYLAST < yyj
|
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
||||||
|| (]b4_safest_int_type[)yycheck[yyj] != yytoken)
|
|
||||||
{
|
{
|
||||||
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -608,8 +608,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
detect an error, take that action. */
|
detect an error, take that action. */
|
||||||
yyn += yytoken;
|
yyn += yytoken;
|
||||||
if (yyn < 0 || yylast_ < yyn
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
||||||
|| (]b4_safest_int_type[)yycheck_[yyn] != yytoken)
|
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Reduce or error. */
|
/* Reduce or error. */
|
||||||
@@ -687,7 +686,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
yyn = yyr1_[yyn];
|
yyn = yyr1_[yyn];
|
||||||
yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
|
yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
|
||||||
if (0 <= yystate && yystate <= yylast_
|
if (0 <= yystate && yystate <= yylast_
|
||||||
&& (]b4_safest_int_type[)yycheck_[yystate] == yystate_stack_[0])
|
&& yycheck_[yystate] == yystate_stack_[0])
|
||||||
yystate = yytable_[yystate];
|
yystate = yytable_[yystate];
|
||||||
else
|
else
|
||||||
yystate = yydefgoto_[yyn - yyntokens_];
|
yystate = yydefgoto_[yyn - yyntokens_];
|
||||||
@@ -760,8 +759,7 @@ b4_error_verbose_if([, yytoken])[));
|
|||||||
if (yyn != yypact_ninf_)
|
if (yyn != yypact_ninf_)
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
&& (]b4_safest_int_type[)yycheck_[yyn] == yyterror_)
|
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -845,7 +843,7 @@ b4_error_verbose_if([, int tok])[)
|
|||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if ((]b4_safest_int_type[)yycheck_[x + yyn] == x && x != yyterror_)
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
@@ -862,8 +860,7 @@ b4_error_verbose_if([, int tok])[)
|
|||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if ((]b4_safest_int_type[)yycheck_[x + yyn] == x
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
&& x != yyterror_)
|
|
||||||
{
|
{
|
||||||
res += (!count++) ? ", expecting " : " or ";
|
res += (!count++) ? ", expecting " : " or ";
|
||||||
res += yytnamerr_ (yytname_[x]);
|
res += yytnamerr_ (yytname_[x]);
|
||||||
|
|||||||
16
data/yacc.c
16
data/yacc.c
@@ -86,15 +86,6 @@ m4_define([b4_int_type],
|
|||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
|
|
||||||
# b4_safest_int_type
|
|
||||||
# ------------------
|
|
||||||
# The safest int type to cast to when it's necessary to compare a signed int
|
|
||||||
# type against an int type set by b4_int_type. Overwrite the version from
|
|
||||||
# c.m4 as a reminder to keep it consistent with overwritten b4_int_type.
|
|
||||||
m4_define([b4_safest_int_type],[int])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -909,7 +900,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||||||
yyfmt = yystpcpy (yyformat, yyunexpected);
|
yyfmt = yystpcpy (yyformat, yyunexpected);
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if ((]b4_safest_int_type[)yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
@@ -1214,7 +1205,7 @@ yybackup:
|
|||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
detect an error, take that action. */
|
detect an error, take that action. */
|
||||||
yyn += yytoken;
|
yyn += yytoken;
|
||||||
if (yyn < 0 || YYLAST < yyn || (]b4_safest_int_type[)yycheck[yyn] != yytoken)
|
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
@@ -1294,8 +1285,7 @@ yyreduce:
|
|||||||
yyn = yyr1[yyn];
|
yyn = yyr1[yyn];
|
||||||
|
|
||||||
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
|
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
|
||||||
if (0 <= yystate && yystate <= YYLAST
|
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
||||||
&& (]b4_safest_int_type[)yycheck[yystate] == *yyssp)
|
|
||||||
yystate = yytable[yystate];
|
yystate = yytable[yystate];
|
||||||
else
|
else
|
||||||
yystate = yydefgoto[yyn - YYNTOKENS];
|
yystate = yydefgoto[yyn - YYNTOKENS];
|
||||||
|
|||||||
Reference in New Issue
Block a user