From: Akim Demaille Date: Thu, 24 May 2012 11:37:28 +0000 (+0200) Subject: Merge tag 'v2.5.1_rc2' X-Git-Tag: v2.7.90~448 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/c547693afdacf4b865027d3bb8c53f601eadb5ae Merge tag 'v2.5.1_rc2' Bison 2.5.1_rc2. * tag 'v2.5.1_rc2': (34 commits) Bison 2.5.1_rc2. doc: fixes. build: fix ChangeLog generation. c++: compute the header guards. skeletons: remove support for unused directive. lalr1.cc: improve Doxygen documentation. lalr1.cc: extract stack.hh. news: convert to double quotes. space changes. build: do not prototype flex-generated functions. build: fix ChangeLog generation. Bison 2.5.1_rc1. tests: save/restore Autotest special files when checking XML support. tests: AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES. tests: honor TESTSUITEFLAGS in all the check targets. build: do not enable c++ warnings on 0 when nullptr is not supported. maint: update gnulib. build: config.in.h. build: move silent rules. glr.c: reduce variable scopes. maint: maintainer-release-check. maint: shush a syntax-check. maint: prefer "commit message" to "log entry". command line: fix minor leaks. maint: we no longer maintain the ChangeLog. maint: fix the generation of the synclines for bison's parser. maint: regen. maint: import the xmemdup0 gnulib module. maint: remove left-over gnulib modules. maint: ignore files imported by autopoint. build: AC_PROG_LEX: use more readable variable names. maint: regen src/parse-gram.[ch] maint: simplify parse-gram.y maint: s/strncpy/memcpy/, when equivalent Conflicts: Makefile.am NEWS data/glr.c data/lalr1.cc data/stack.hh examples/rpcalc/local.mk src/flex-scanner.h src/getargs.c src/output.c src/parse-gram.c src/parse-gram.h src/parse-gram.y tests/Makefile.am tests/bison.in --- c547693afdacf4b865027d3bb8c53f601eadb5ae diff --cc build-aux/.gitignore index 3a663bf0,f09add4f..008e7452 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@@ -4,6 -6,6 +4,7 @@@ /compile /config.guess /config.rpath ++/config.rpath~ /config.sub /depcomp /gendocs.sh diff --cc cfg.mk index ce755393,a208fe9c..6ccef9c9 --- a/cfg.mk +++ b/cfg.mk @@@ -56,11 -62,12 +56,12 @@@ $(call exclude, bindtextdomain=^lib/main.c$$ \ program_name=^lib/main.c$$ \ prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \ + prohibit_always-defined_macros+=?|^lib/timevar.c$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \ - prohibit_empty_lines_at_EOF=^src/parse-gram.[ch]$$ \ + prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \ + prohibit_strcmp=^doc/bison\.texinfo$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ space_tab=^tests/(input|c\+\+)\.at$$ \ - trailing_blank=^src/parse-gram.[ch]$$ \ unmarked_diagnostics=^djgpp/ \ ) diff --cc data/glr.c index e6a8e381,5f7aac84..8f77aa61 --- a/data/glr.c +++ b/data/glr.c @@@ -810,21 -868,13 +810,20 @@@ static void yyfillin (yyGLRStackItem * static void yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1) { - yyGLRState* s; int i; - s = yyvsp[yylow0].yystate.yypred; + yyGLRState *s = yyvsp[yylow0].yystate.yypred; for (i = yylow0-1; i >= yylow1; i -= 1) { - YYASSERT (s->yyresolved); - yyvsp[i].yystate.yyresolved = yytrue; - yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;]b4_locations_if([[ +#if YYDEBUG + yyvsp[i].yystate.yylrState = s->yylrState; +#endif + yyvsp[i].yystate.yyresolved = s->yyresolved; + if (s->yyresolved) + yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval; + else + /* The effect of using yysval or yyloc (in an immediate rule) is + * undefined. */ + yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[ yyvsp[i].yystate.yyloc = s->yyloc;]])[ s = yyvsp[i].yystate.yypred = s->yypred; } diff --cc data/lalr1.cc index ef5e1cee,4f0b2688..92f93c2c --- a/data/lalr1.cc +++ b/data/lalr1.cc @@@ -124,24 -24,28 +124,27 @@@ m4_define([b4_parser_class_name] b4_defines_if([], [b4_fatal([b4_skeleton[: using %%defines is mandatory]])]) -b4_percent_define_ifdef([[location_type]], [], +b4_locations_if([b4_percent_define_ifdef([[location_type]], [], [# Backward compatibility. -- m4_define([b4_location_constructors]) - m4_include(b4_pkgdatadir/[location.cc])])]) - m4_include(b4_pkgdatadir/[location.cc])]) ++ m4_define([b4_location_constructors]) ++ m4_include(b4_pkgdatadir/[location.cc])])]) m4_include(b4_pkgdatadir/[stack.hh]) +b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])]) # We do want M4 expansion after # for CPP macros. m4_changecom() m4_divert_push(0)dnl -b4_defines_if( -[@output(b4_spec_defines_file@)@ -b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++], - [2002-2012]) +@output(b4_spec_defines_file@)@ +b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++]) - dnl FIXME: This is wrong, we want computed header guards. [ + /** + ** \file ]b4_spec_defines_file[ + ** Define the ]b4_namespace_ref[::parser class. + */ + /* C++ LALR(1) parser skeleton written by Akim Demaille. */ - #ifndef PARSER_HEADER_H - # define PARSER_HEADER_H + ]b4_cpp_guard_open([b4_spec_defines_file])[ ]b4_percent_code_get([[requires]])[ @@@ -358,12 -281,13 +361,11 @@@ b4_public_types_define]) /* Redirection for backward compatibility. */ # define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type #endif - ]) - b4_percent_code_get([[provides]])[]dnl - - [#endif /* ! defined PARSER_HEADER_H */] + ])[ + ]b4_percent_code_get([[provides]])[ + ]b4_cpp_guard_close([b4_spec_defines_file]) -])dnl @output(b4_parser_file_name@)@ -b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++], - [2002-2012]) +b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++]) b4_percent_code_get([[top]])[]dnl m4_if(b4_prefix, [yy], [], [ diff --cc data/location.cc index e750779c,f45f634e..976fc34b --- a/data/location.cc +++ b/data/location.cc @@@ -22,10 -19,11 +22,10 @@@ m4_pushdef([b4_copyright_years] m4_changecom() m4_divert_push(0)dnl @output(b4_dir_prefix[]position.hh@)@ -b4_copyright([Positions for Bison parsers in C++], - [2002-2007, 2009-2012])[ +b4_copyright([Positions for Bison parsers in C++])[ /** - ** \file position.hh + ** \file ]b4_dir_prefix[position.hh ** Define the ]b4_namespace_ref[::position class. */ @@@ -150,12 -147,13 +149,12 @@@ } ]b4_namespace_close[ - #endif // not BISON_POSITION_HH] + ]b4_cpp_guard_close([b4_dir_prefix[]position.hh]) @output(b4_dir_prefix[]location.hh@)@ -b4_copyright([Locations for Bison parsers in C++], - [2002-2007, 2009-2012])[ +b4_copyright([Locations for Bison parsers in C++])[ /** - ** \file location.hh + ** \file ]b4_dir_prefix[location.hh ** Define the ]b4_namespace_ref[::location class. */ @@@ -296,7 -293,6 +294,7 @@@ ]b4_namespace_close[ - #endif // not BISON_LOCATION_HH] + ]b4_cpp_guard_close([b4_dir_prefix[]location.hh]) m4_divert_pop(0) +m4_popdef([b4_copyright_years])dnl m4_changecom([#]) diff --cc data/stack.hh index dcd0832b,ddedc79b..cea7b41a --- a/data/stack.hh +++ b/data/stack.hh @@@ -22,12 -22,17 +22,16 @@@ m4_pushdef([b4_copyright_years] m4_changecom() m4_divert_push(0)dnl @output(b4_dir_prefix[]stack.hh@)@ -b4_copyright([Stack handling for Bison parsers in C++], - [2002-2012])[ +b4_copyright([Stack handling for Bison parsers in C++])[ - #ifndef BISON_STACK_HH - # define BISON_STACK_HH + /** + ** \file ]b4_dir_prefix[stack.hh + ** Define the ]b4_namespace_ref[::stack class. + */ - #include + ]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[ + + # include ]b4_namespace_open[ template > diff --cc m4/.gitignore index 90e5ae15,d47aee02..990b1a57 --- a/m4/.gitignore +++ b/m4/.gitignore @@@ -47,7 -48,11 +48,12 @@@ /iconv.m4 /include_next.m4 /inline.m4 + /intdiv0.m4 + /intl.m4 ++/intl.m4~ + /intldir.m4 /intlmacosx.m4 + /intmax.m4 /intmax_t.m4 /inttypes-pri.m4 /inttypes.m4 @@@ -88,12 -95,11 +96,13 @@@ /multiarch.m4 /nls.m4 /nocrash.m4 ++/off_t.m4 /open.m4 /pathmax.m4 /perror.m4 - /pipe.m4 /pipe2.m4 /po.m4 ++/po.m4~ /posix_spawn.m4 /printf-frexp.m4 /printf-frexpl.m4 @@@ -144,9 -150,11 +153,12 @@@ /sys_ioctl_h.m4 /sys_socket_h.m4 /sys_stat_h.m4 ++/sys_types_h.m4 /sys_wait_h.m4 + /sysexits.m4 /threadlib.m4 /time_h.m4 + /uintmax_t.m4 /unistd-safer.m4 /unistd_h.m4 /unlocked-io.m4 @@@ -167,4 -176,5 +180,3 @@@ /xalloc.m4 /xsize.m4 /xstrndup.m4 - /sysexits.m4 -/off_t.m4 -/sys_types_h.m4 diff --cc po/.gitignore index 79594c04,79594c04..940ce9ef --- a/po/.gitignore +++ b/po/.gitignore @@@ -6,6 -6,6 +6,7 @@@ /Makefile /Makefile.in /Makefile.in.in ++/Makefile.in.in~ /Makevars /Makevars.template /POTFILES diff --cc runtime-po/.gitignore index 44ff8963,44ff8963..8675428f --- a/runtime-po/.gitignore +++ b/runtime-po/.gitignore @@@ -6,6 -6,6 +6,7 @@@ /Makefile /Makefile.in /Makefile.in.in ++/Makefile.in.in~ /Makevars /Makevars.template /POTFILES diff --cc src/flex-scanner.h index 572464af,99798411..cf2b6b9e --- a/src/flex-scanner.h +++ b/src/flex-scanner.h @@@ -21,7 -21,20 +21,20 @@@ # error "FLEX_PREFIX not defined" #endif + /* Whether this version of Flex is (strictly) greater than + Major.Minor.Subminor. */ + #define FLEX_VERSION_GT(Major, Minor, Subminor) \ + (defined YY_FLEX_MAJOR_VERSION \ + && (Major < YY_FLEX_MAJOR_VERSION \ + || (Major == YY_FLEX_MAJOR_VERSION \ + && (defined YY_FLEX_MINOR_VERSION \ + && (Minor < YY_FLEX_MINOR_VERSION \ + || (Minor == YY_FLEX_MINOR_VERSION \ + && defined YY_FLEX_SUBMINOR_VERSION \ + && Subminor < YY_FLEX_SUBMINOR_VERSION)))))) + /* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ -# if ! FLEX_VERSION_GT (2, 5, 31) ++#if ! FLEX_VERSION_GT (2, 5, 31) int FLEX_PREFIX (get_lineno) (void); FILE *FLEX_PREFIX (get_in) (void); FILE *FLEX_PREFIX (get_out) (void); @@@ -73,16 -82,16 +82,16 @@@ int FLEX_PREFIX (lex_destroy) (void) static struct obstack obstack_for_string; - #define STRING_GROW \ -# define STRING_GROW \ ++# define STRING_GROW \ obstack_grow (&obstack_for_string, yytext, yyleng) - #define STRING_FINISH \ -# define STRING_FINISH \ - do { \ - obstack_1grow (&obstack_for_string, '\0'); \ - last_string = obstack_finish (&obstack_for_string); \ ++# define STRING_FINISH \ + do { \ + obstack_1grow (&obstack_for_string, '\0'); \ + last_string = obstack_finish (&obstack_for_string); \ } while (0) - #define STRING_FREE \ -# define STRING_FREE \ ++# define STRING_FREE \ obstack_free (&obstack_for_string, last_string) #endif diff --cc src/getargs.c index 06e6e972,3fa2a7af..8a3714e2 --- a/src/getargs.c +++ b/src/getargs.c @@@ -607,73 -613,77 +610,80 @@@ getargs (int argc, char *argv[] break; case 'g': - graph_flag = true; - if (optarg) + graph_flag = true; + if (optarg) - spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); + { + free (spec_graph_file); + spec_graph_file = xstrdup (AS_FILE_NAME (optarg)); + } - break; + break; case 'h': - usage (EXIT_SUCCESS); + usage (EXIT_SUCCESS); case 'k': - token_table_flag = true; - break; + token_table_flag = true; + break; case 'l': - no_lines_flag = true; - break; + no_lines_flag = true; + break; case 'o': - spec_outfile = AS_FILE_NAME (optarg); - break; + spec_outfile = AS_FILE_NAME (optarg); + break; case 'p': - spec_name_prefix = optarg; - break; + spec_name_prefix = optarg; + break; case 'r': - FLAGS_ARGMATCH (report, optarg); - break; + FLAGS_ARGMATCH (report, optarg); + break; case 't': - debug_flag = true; - break; + muscle_percent_define_insert ("parse.trace", + command_line_location (), "", + MUSCLE_PERCENT_DEFINE_D); + break; case 'v': - report_flag |= report_states; - break; + report_flag |= report_states; + break; case 'x': - xml_flag = true; - if (optarg) + xml_flag = true; + if (optarg) - spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); + { + free (spec_xml_file); + spec_xml_file = xstrdup (AS_FILE_NAME (optarg)); + } - break; + break; case 'y': - yacc_flag = true; - break; + yacc_flag = true; + break; case LOCATIONS_OPTION: - locations_flag = true; - break; + muscle_percent_define_ensure ("locations", + command_line_location (), true); + break; case PRINT_LOCALEDIR_OPTION: - printf ("%s\n", LOCALEDIR); - exit (EXIT_SUCCESS); + printf ("%s\n", LOCALEDIR); + exit (EXIT_SUCCESS); case PRINT_DATADIR_OPTION: - printf ("%s\n", compute_pkgdatadir ()); - exit (EXIT_SUCCESS); + printf ("%s\n", compute_pkgdatadir ()); + exit (EXIT_SUCCESS); case REPORT_FILE_OPTION: + free (spec_verbose_file); - spec_verbose_file = xstrdup (AS_FILE_NAME (optarg)); - break; + spec_verbose_file = xstrdup (AS_FILE_NAME (optarg)); + break; default: - usage (EXIT_FAILURE); + usage (EXIT_FAILURE); } if (argc - optind != 1) diff --cc src/parse-gram.y index 532349bb,eb034b08..74eb4aee --- a/src/parse-gram.y +++ b/src/parse-gram.y @@@ -775,21 -734,8 +776,11 @@@ add_param (param_type type, char *decl complain_at (loc, _("missing identifier in parameter declaration")); else { - char *name; - size_t name_len; - - for (name_len = 1; - memchr (alphanum, name_start[name_len], sizeof alphanum); - name_len++) - continue; - - name = xmalloc (name_len + 1); - memcpy (name, name_start, name_len); - name[name_len] = '\0'; + char *name = xmemdup0 (name_start, strspn (name_start, alphanum)); - muscle_pair_list_grow (type, decl, name); + if (type & param_lex) + muscle_pair_list_grow ("lex_param", decl, name); + if (type & param_parse) + muscle_pair_list_grow ("parse_param", decl, name); free (name); } diff --cc tests/regression.at index 41a2939d,f5603eae..ff798a87 --- a/tests/regression.at +++ b/tests/regression.at @@@ -1253,15 -1262,16 +1253,17 @@@ AT_CLEANU AT_SETUP([[parse-gram.y: LALR = IELR]]) -# Avoid differences in synclines by telling bison that the output files -# have the same name. +# Avoid tests/bison's dark magic by processing a local copy of the +# grammar. Avoid differences in synclines by telling bison that the +# output files have the same name. [cp $abs_top_srcdir/src/parse-gram.y input.y] AT_BISON_CHECK([[-o input.c -Dlr.type=lalr input.y]]) - [mv input.c expout] + [mv input.c lalr.c] + AT_CAPTURE_FILE([lalr.c]) AT_BISON_CHECK([[-o input.c -Dlr.type=ielr input.y]]) [mv input.c ielr.c] - AT_CHECK([[cat ielr.c]], [[0]], [[expout]]) + AT_CAPTURE_FILE([ielr.c]) + AT_CHECK([[diff lalr.c ielr.c]], [[0]]) AT_CLEANUP