mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
build: reenable -Wtype-limits
See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html to https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00073.html. Paul Eggert's changes in gnulib do fix the issue for modern GCCs (7, 8, 9) on macOS. Unfortunately these warnings are back on the CI (GNU/Linux) with GCC 4.6, 4.7, (not 4.8) and 4.9. Disable the warning locally. * configure.ac (warn_common, warn_tests): Remove -Wtype-limits. * src/system.h (IGNORE_TYPE_LIMITS_BEGIN, IGNORE_TYPE_LIMITS_END): New. * src/InadequacyList.c, src/parse-gram.c, src/parse-gram.y, * src/symtab.c: Use it.
This commit is contained in:
@@ -96,14 +96,11 @@ AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
|||||||
if test "$enable_gcc_warnings" = yes; then
|
if test "$enable_gcc_warnings" = yes; then
|
||||||
# -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and
|
# -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and
|
||||||
# 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV,
|
# 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV,
|
||||||
# etc. It's also for these macros, but on GCC 7, 8 and 9 on macOS
|
# etc.
|
||||||
# and GCC 4.6, 4.7 and 4.9 on GNU/Linux, that we disable
|
|
||||||
# -Wtype-limits globally. See
|
|
||||||
# https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html.
|
|
||||||
warn_common='-Wall -Wextra -Wcast-align
|
warn_common='-Wall -Wextra -Wcast-align
|
||||||
-fparse-all-comments -Wdocumentation
|
-fparse-all-comments -Wdocumentation
|
||||||
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
||||||
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare -Wno-type-limits
|
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
||||||
-Wpointer-arith -Wshadow
|
-Wpointer-arith -Wshadow
|
||||||
-Wwrite-strings'
|
-Wwrite-strings'
|
||||||
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
||||||
@@ -119,7 +116,7 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
# details for lalr1.cc.
|
# details for lalr1.cc.
|
||||||
warn_tests='-Wundef -pedantic -Wconversion
|
warn_tests='-Wundef -pedantic -Wconversion
|
||||||
-Wdeprecated -Wsign-compare -Wsign-conversion
|
-Wdeprecated -Wsign-compare -Wsign-conversion
|
||||||
-Wtautological-constant-out-of-range-compare -Wtype-limits
|
-Wtautological-constant-out-of-range-compare
|
||||||
-fno-color-diagnostics
|
-fno-color-diagnostics
|
||||||
-Wno-keyword-macro'
|
-Wno-keyword-macro'
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ InadequacyList__new_conflict (state *manifesting_state, symbol *token,
|
|||||||
{
|
{
|
||||||
InadequacyList *result = xmalloc (sizeof *result);
|
InadequacyList *result = xmalloc (sizeof *result);
|
||||||
result->id = *node_count;
|
result->id = *node_count;
|
||||||
|
IGNORE_TYPE_LIMITS_BEGIN
|
||||||
if (INT_ADD_WRAPV (*node_count, 1, node_count))
|
if (INT_ADD_WRAPV (*node_count, 1, node_count))
|
||||||
aver (false);
|
aver (false);
|
||||||
|
IGNORE_TYPE_LIMITS_END
|
||||||
result->next = NULL;
|
result->next = NULL;
|
||||||
result->manifestingState = manifesting_state;
|
result->manifestingState = manifesting_state;
|
||||||
result->contributionCount = bitset_count (actions);
|
result->contributionCount = bitset_count (actions);
|
||||||
|
|||||||
@@ -2988,6 +2988,7 @@ handle_pure_parser (location const *loc, char const *directive)
|
|||||||
static int
|
static int
|
||||||
str_to_version (char const *version)
|
str_to_version (char const *version)
|
||||||
{
|
{
|
||||||
|
IGNORE_TYPE_LIMITS_BEGIN
|
||||||
int res = 0;
|
int res = 0;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
@@ -3004,6 +3005,7 @@ str_to_version (char const *version)
|
|||||||
|| INT_ADD_WRAPV (minor, res, &res))
|
|| INT_ADD_WRAPV (minor, res, &res))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
IGNORE_TYPE_LIMITS_END
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -979,6 +979,7 @@ handle_pure_parser (location const *loc, char const *directive)
|
|||||||
static int
|
static int
|
||||||
str_to_version (char const *version)
|
str_to_version (char const *version)
|
||||||
{
|
{
|
||||||
|
IGNORE_TYPE_LIMITS_BEGIN
|
||||||
int res = 0;
|
int res = 0;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
@@ -995,6 +996,7 @@ str_to_version (char const *version)
|
|||||||
|| INT_ADD_WRAPV (minor, res, &res))
|
|| INT_ADD_WRAPV (minor, res, &res))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
IGNORE_TYPE_LIMITS_END
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1010,8 +1010,10 @@ symbols_token_translations_init (void)
|
|||||||
sym_content *this = symbols[i]->content;
|
sym_content *this = symbols[i]->content;
|
||||||
if (this->user_token_number == USER_NUMBER_UNDEFINED)
|
if (this->user_token_number == USER_NUMBER_UNDEFINED)
|
||||||
{
|
{
|
||||||
|
IGNORE_TYPE_LIMITS_BEGIN
|
||||||
if (INT_ADD_WRAPV (max_user_token_number, 1, &max_user_token_number))
|
if (INT_ADD_WRAPV (max_user_token_number, 1, &max_user_token_number))
|
||||||
complain (NULL, fatal, _("token number too large"));
|
complain (NULL, fatal, _("token number too large"));
|
||||||
|
IGNORE_TYPE_LIMITS_END
|
||||||
this->user_token_number = max_user_token_number;
|
this->user_token_number = max_user_token_number;
|
||||||
}
|
}
|
||||||
if (this->user_token_number > max_user_token_number)
|
if (this->user_token_number > max_user_token_number)
|
||||||
|
|||||||
14
src/system.h
14
src/system.h
@@ -74,6 +74,20 @@ typedef size_t uintptr_t;
|
|||||||
# include <xalloc.h>
|
# include <xalloc.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* See https://lists.gnu.org/archive/html/bug-bison/2019-10/msg00061.html. */
|
||||||
|
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ < 5
|
||||||
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
|
# define IGNORE_TYPE_LIMITS_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wtype-limits\"")
|
||||||
|
# define IGNORE_TYPE_LIMITS_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
|
# define IGNORE_TYPE_LIMITS_BEGIN
|
||||||
|
# define IGNORE_TYPE_LIMITS_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*-----------------.
|
/*-----------------.
|
||||||
| GCC extensions. |
|
| GCC extensions. |
|
||||||
`-----------------*/
|
`-----------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user