From: Eric Blake Date: Thu, 20 Aug 2009 22:52:19 +0000 (-0600) Subject: Make previous patch more robust. X-Git-Tag: v2.5_rc1~185 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/aa50ba7bff6459a480fa9b2372304789b7f05eda?ds=sidebyside Make previous patch more robust. * src/output.c (ARRAY_CARDINALITY): New macro, copied from argmatch.h. (output_skeleton): Use it. Suggested by Akim Demaille. Signed-off-by: Eric Blake (cherry picked from commit 1266b636740f0c6719d8cc11a5d569084fa37009) --- diff --git a/ChangeLog b/ChangeLog index 8fd9ffdc..0b7631bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-08-20 Eric Blake + Make previous patch more robust. + * src/output.c (ARRAY_CARDINALITY): New macro, copied from + argmatch.h. + (output_skeleton): Use it. + Suggested by Akim Demaille. + Import latest m4/m4.m4. * submodules/autoconf: Update to autoconf 2.64. * configure.ac (M4_GNU_OPTION): New define. @@ -66,12 +72,12 @@ that perfectly supported Bison mo files. Lower the requirement. http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html - * configure.ac: Require need-ngettext instead of - need-formatstring-macros. - Reported by Martin Jabocs. - Suggested by Bruno Haible. - * INSTALL: Restructure. - (Internationalization): New. + * configure.ac: Require need-ngettext instead of + need-formatstring-macros. + Reported by Martin Jabocs. + Suggested by Bruno Haible. + * INSTALL: Restructure. + (Internationalization): New. 2009-08-14 Joel E. Denny @@ -103,7 +109,7 @@ distcheck: fix. - * examples/calc++/Makefile.am: (EXTRA_DIST): Ship calc.stamp. + * examples/calc++/Makefile.am: (EXTRA_DIST): Ship calc.stamp. 2009-08-10 Joel E. Denny @@ -392,13 +398,13 @@ 2009-05-25 Akim Demaille gnulib: update. - * gnulib: Update to latest. - * lib/.cvsignore, lib/.gitignore, m4/.cvsignore, - * m4/.gitignore: Regen. - * src/symtab.c (symbol_from_uniqstr, semantic_type_from_uniqstr): - Call xalloc_die on hash_insert failures. - Requested by the new __warn_unused_result__ attribute of - hash_insert. + * gnulib: Update to latest. + * lib/.cvsignore, lib/.gitignore, m4/.cvsignore, + * m4/.gitignore: Regen. + * src/symtab.c (symbol_from_uniqstr, semantic_type_from_uniqstr): + Call xalloc_die on hash_insert failures. + Requested by the new __warn_unused_result__ attribute of + hash_insert. 2009-05-22 Joel E. Denny diff --git a/src/output.c b/src/output.c index 6e9a76fb..2d10a27d 100644 --- a/src/output.c +++ b/src/output.c @@ -21,6 +21,7 @@ #include #include "system.h" +#include #include #include #include @@ -40,6 +41,7 @@ #include "symtab.h" #include "tables.h" +# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) static struct obstack format_obstack; @@ -564,6 +566,7 @@ output_skeleton (void) argv[i++] = full_m4bison; argv[i++] = full_skeleton; argv[i++] = NULL; + assert (i <= ARRAY_CARDINALITY (argv)); } init_subpipe ();