mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Merge branch 'branch-2.6' into maint
* origin/branch-2.6: regen yacc.c: do not define location support when not using locations maint: be compilable with GCC 4.0 tests: address a warning from GCC 4.4 tests: don't use options that Clang does not support tests: restore the tests on -Werror regen parse-gram: update the Bison interface fix comment
This commit is contained in:
18
configure.ac
18
configure.ac
@@ -72,6 +72,18 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
-Wshadow -Wstrict-prototypes'
|
-Wshadow -Wstrict-prototypes'
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
|
# Clang supports many of GCC's -W options, but only issues warnings
|
||||||
|
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||||
|
# thinks the option is supported, and unknown options are then added
|
||||||
|
# to CFLAGS. But then, when -Werror is added in the test suite for
|
||||||
|
# instance, the warning about the unknown option turns into an
|
||||||
|
# error.
|
||||||
|
#
|
||||||
|
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
||||||
|
# meanwhile, turn warnings about unknown options into errors in
|
||||||
|
# CFLAGS, and restore CFLAGS after the tests.
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
@@ -80,19 +92,23 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||||
for i in $warn_common $warn_cxx;
|
for i in $warn_common $warn_cxx;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([ -Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ m4_define([b4_YYDEBUG_define],
|
|||||||
# endif
|
# endif
|
||||||
# else /* ! defined YYDEBUG */
|
# else /* ! defined YYDEBUG */
|
||||||
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
||||||
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
|
# endif /* ! defined YYDEBUG */
|
||||||
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
11
data/yacc.c
11
data/yacc.c
@@ -769,10 +769,9 @@ while (YYID (0))
|
|||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
]b4_locations_if([[
|
|
||||||
|
|
||||||
|
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
This macro was not mandated originally: define only if we know
|
This macro was not mandated originally: define only if we know
|
||||||
@@ -787,18 +786,14 @@ while (YYID (0))
|
|||||||
# else
|
# else
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
# endif
|
# endif
|
||||||
#endif]], [[
|
#endif]],
|
||||||
|
[[/* This macro is provided for backward compatibility. */
|
||||||
|
|
||||||
/* This macro is provided for backward compatibility. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
#ifndef YY_LOCATION_PRINT
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
#endif]])[
|
#endif]])[
|
||||||
|
|
||||||
|
|
||||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
|
|
||||||
#ifdef YYLEX_PARAM
|
#ifdef YYLEX_PARAM
|
||||||
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
bool debug_flag;
|
bool debug;
|
||||||
bool defines_flag;
|
bool defines_flag;
|
||||||
bool graph_flag;
|
bool graph_flag;
|
||||||
bool xml_flag;
|
bool xml_flag;
|
||||||
@@ -665,7 +665,7 @@ getargs (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
debug_flag = true;
|
debug = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ extern int skeleton_prio;
|
|||||||
/* for -I */
|
/* for -I */
|
||||||
extern char const *include;
|
extern char const *include;
|
||||||
|
|
||||||
extern bool debug_flag; /* for -t */
|
extern bool debug; /* for -t */
|
||||||
extern bool defines_flag; /* for -d */
|
extern bool defines_flag; /* for -d */
|
||||||
extern bool graph_flag; /* for -g */
|
extern bool graph_flag; /* for -g */
|
||||||
extern bool xml_flag; /* for -x */
|
extern bool xml_flag; /* for -x */
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ typedef struct
|
|||||||
|
|
||||||
} location;
|
} location;
|
||||||
|
|
||||||
#define YYLTYPE location
|
#define GRAM_LTYPE location
|
||||||
|
|
||||||
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
||||||
extern location const empty_location;
|
extern location const empty_location;
|
||||||
|
|||||||
@@ -626,7 +626,7 @@ prepare (void)
|
|||||||
use_push_for_pull_flag = true;
|
use_push_for_pull_flag = true;
|
||||||
|
|
||||||
/* Flags. */
|
/* Flags. */
|
||||||
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
MUSCLE_INSERT_BOOL ("debug_flag", debug);
|
||||||
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
||||||
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
||||||
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
||||||
|
|||||||
388
src/parse-gram.c
388
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.6.3.3-b10d3. */
|
/* A Bison parser, made by GNU Bison 2.6.4.11-d01f-dirty. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -33,19 +33,27 @@
|
|||||||
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
# define YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
# define YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef GRAM_DEBUG
|
||||||
# define YYDEBUG 1
|
# if defined YYDEBUG
|
||||||
#endif
|
# if YYDEBUG
|
||||||
#if YYDEBUG
|
# define GRAM_DEBUG 1
|
||||||
|
# else
|
||||||
|
# define GRAM_DEBUG 0
|
||||||
|
# endif
|
||||||
|
# else /* ! defined YYDEBUG */
|
||||||
|
# define GRAM_DEBUG 1
|
||||||
|
# endif /* ! defined YYDEBUG */
|
||||||
|
#endif /* ! defined GRAM_DEBUG */
|
||||||
|
#if GRAM_DEBUG
|
||||||
extern int gram_debug;
|
extern int gram_debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef GRAM_TOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define GRAM_TOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum gram_tokentype {
|
||||||
GRAM_EOF = 0,
|
GRAM_EOF = 0,
|
||||||
STRING = 258,
|
STRING = 258,
|
||||||
INT = 259,
|
INT = 259,
|
||||||
@@ -164,10 +172,10 @@ extern int gram_debug;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union GRAM_STYPE
|
||||||
{
|
{
|
||||||
/* Line 2077 of yacc.c */
|
/* Line 2072 of yacc.c */
|
||||||
#line 115 "parse-gram.y"
|
#line 115 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -181,25 +189,25 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
/* Line 2077 of yacc.c */
|
/* Line 2072 of yacc.c */
|
||||||
#line 186 "parse-gram.h"
|
#line 194 "parse-gram.h"
|
||||||
} YYSTYPE;
|
} GRAM_STYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define GRAM_STYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define gram_stype GRAM_STYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define GRAM_STYPE_IS_DECLARED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
#if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
|
||||||
typedef struct YYLTYPE
|
typedef struct GRAM_LTYPE
|
||||||
{
|
{
|
||||||
int first_line;
|
int first_line;
|
||||||
int first_column;
|
int first_column;
|
||||||
int last_line;
|
int last_line;
|
||||||
int last_column;
|
int last_column;
|
||||||
} YYLTYPE;
|
} GRAM_LTYPE;
|
||||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
# define gram_ltype GRAM_LTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
# define GRAM_LTYPE_IS_DECLARED 1
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
# define GRAM_LTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,14 +94,14 @@ current_lhs(symbol *sym, location loc, named_ref *ref)
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%debug
|
%debug
|
||||||
%verbose
|
%define api.prefix "gram_"
|
||||||
%defines
|
%define api.pure
|
||||||
%locations
|
|
||||||
%pure-parser
|
|
||||||
%error-verbose
|
|
||||||
%define parse.lac full
|
%define parse.lac full
|
||||||
%name-prefix="gram_"
|
%defines
|
||||||
|
%error-verbose
|
||||||
%expect 0
|
%expect 0
|
||||||
|
%locations
|
||||||
|
%verbose
|
||||||
|
|
||||||
%initial-action
|
%initial-action
|
||||||
{
|
{
|
||||||
@@ -252,7 +252,7 @@ prologue_declaration:
|
|||||||
plain_code.code, @1);
|
plain_code.code, @1);
|
||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
| "%debug" { debug_flag = true; }
|
| "%debug" { debug = true; }
|
||||||
| "%define" variable content.opt
|
| "%define" variable content.opt
|
||||||
{
|
{
|
||||||
muscle_percent_define_insert ($2, @2, $3,
|
muscle_percent_define_insert ($2, @2, $3,
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ void grammar_current_rule_prec_set (symbol *precsym, location loc);
|
|||||||
void grammar_current_rule_dprec_set (int dprec, location loc);
|
void grammar_current_rule_dprec_set (int dprec, location loc);
|
||||||
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
||||||
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void grammar_current_rule_action_append (const char *action, location loc,
|
void grammar_current_rule_action_append (const char *action, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void reader (void);
|
void reader (void);
|
||||||
void free_merger_functions (void);
|
void free_merger_functions (void);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void gram_scanner_last_string_free (void);
|
|||||||
extern FILE *gram_out;
|
extern FILE *gram_out;
|
||||||
extern int gram_lineno;
|
extern int gram_lineno;
|
||||||
|
|
||||||
# define GRAM_LEX_DECL int gram_lex (YYSTYPE *val, location *loc)
|
# define GRAM_LEX_DECL int gram_lex (GRAM_STYPE *val, location *loc)
|
||||||
GRAM_LEX_DECL;
|
GRAM_LEX_DECL;
|
||||||
|
|
||||||
#endif /* !SCAN_GRAM_H_ */
|
#endif /* !SCAN_GRAM_H_ */
|
||||||
|
|||||||
@@ -462,10 +462,14 @@ m4_define([AT_BISON_CHECK_WARNINGS],
|
|||||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||||
|
|
||||||
m4_define([AT_BISON_CHECK_WARNINGS_],
|
m4_define([AT_BISON_CHECK_WARNINGS_],
|
||||||
[[# Defining POSIXLY_CORRECT causes bison to complain if options
|
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
||||||
# are added after the grammar file name, so skip these checks
|
# added after the grammar file name, so skip these checks in that
|
||||||
# in that case.
|
# case.
|
||||||
if test -z "${POSIXLY_CORRECT+set}"; then
|
#
|
||||||
|
# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
|
||||||
|
# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
|
||||||
|
# the environment variable.
|
||||||
|
if env | grep '^POSIXLY_CORRECT=' >/dev/null; then :; else
|
||||||
]AT_SAVE_SPECIAL_FILES[
|
]AT_SAVE_SPECIAL_FILES[
|
||||||
|
|
||||||
# To avoid expanding it repeatedly, store specified stdout.
|
# To avoid expanding it repeatedly, store specified stdout.
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ int
|
|||||||
main (int argc, const char **argv)
|
main (int argc, const char **argv)
|
||||||
{
|
{
|
||||||
YYSTYPE yylval_init = get_args (argc, argv);
|
YYSTYPE yylval_init = get_args (argc, argv);
|
||||||
int status;
|
int status = 0;
|
||||||
int count;
|
int count;
|
||||||
]m4_bmatch([$2], [api.push-pull both],
|
]m4_bmatch([$2], [api.push-pull both],
|
||||||
[[ yypstate *ps = yypstate_new ();
|
[[ yypstate *ps = yypstate_new ();
|
||||||
|
|||||||
Reference in New Issue
Block a user