bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison-generated code causes compilation failure on OpenBSD 4.7


From: Paul Eggert
Subject: Re: bison-generated code causes compilation failure on OpenBSD 4.7
Date: Fri, 08 Oct 2010 12:16:13 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

Thanks, I installed this (slightly-different) patch.  At some point
Bison can be upgraded to assume C89 but right now I want to fix just
this problem.  Rather than catalog all the witnesses that might be out
there, this patch just uses a standard one, EXIT_SUCCESS.

>From bb2389fe0b26f84ecd3eef185a3b955d5d34ff7f Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Fri, 8 Oct 2010 12:12:48 -0700
Subject: [PATCH] Fix portability problem on OpenBSD 4.7.

Jim Meyering reported this in
<http://lists.gnu.org/archive/html/bug-bison/2010-10/msg00007.html>.
* data/yacc.c: Use EXIT_SUCCESS as a witness for stdlib.h,
not _STDLIB_H.  EXIT_SUCCESS has been defined by the standard
for quite some time.
* src/parse-gram.c, src/parse-gram.h: Regenerate.
* tests/regression.at: Tamper with the renamed witness.
---
 ChangeLog           |   10 ++++++++++
 data/yacc.c         |   16 ++++++++--------
 src/parse-gram.c    |   20 ++++++++++----------
 src/parse-gram.h    |    2 +-
 tests/regression.at |    6 +++---
 5 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 65a7c02..0527835 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-10-08  Paul Eggert  <address@hidden>
 
+       Fix portability problem on OpenBSD 4.7.
+
+       Jim Meyering reported this in
+       <http://lists.gnu.org/archive/html/bug-bison/2010-10/msg00007.html>.
+       * data/yacc.c: Use EXIT_SUCCESS as a witness for stdlib.h,
+       not _STDLIB_H.  EXIT_SUCCESS has been defined by the standard
+       for quite some time.
+       * src/parse-gram.c, src/parse-gram.h: Regenerate.
+       * tests/regression.at: Tamper with the renamed witness.
+
        Adjust to recent changes to gnulib bootstrap.
 
        * .cvsignore, build-aux/.cvsignore, doc/.cvsignore, etc/.cvsignore:
diff --git a/data/yacc.c b/data/yacc.c
index 28a2b23..e41e2e9 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -419,10 +419,10 @@ typedef short int yytype_int16;
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && ]b4_c_modern[
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && ]b4_c_modern[
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
 #     endif
 #    endif
 #   endif
@@ -446,23 +446,23 @@ typedef short int yytype_int16;
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[
+#   if ! defined malloc && ! defined EXIT_SUCCESS && ]b4_c_modern[
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[
+#   if ! defined free && ! defined EXIT_SUCCESS && ]b4_c_modern[
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
diff --git a/src/parse-gram.c b/src/parse-gram.c
index e571341..df7ed1f 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.4.516-804e.  */
+/* A Bison parser, made by GNU Bison 2.4.533-95aed.  */
 
 /* Implementation for Bison's Yacc-like parsers in C
 
@@ -45,7 +45,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.516-804e"
+#define YYBISON_VERSION "2.4.533-95aed"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -472,11 +472,11 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || 
defined __C99__FUNC__ \
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || 
defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
 #     endif
 #    endif
 #   endif
@@ -499,24 +499,24 @@ YYID (yyi)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined 
__C99__FUNC__ \
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || 
defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined 
__C99__FUNC__ \
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || 
defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
diff --git a/src/parse-gram.h b/src/parse-gram.h
index d8eea03..2f5654c 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.4.516-804e.  */
+/* A Bison parser, made by GNU Bison 2.4.533-95aed.  */
 
 /* Interface for Bison's Yacc-like parsers in C
 
diff --git a/tests/regression.at b/tests/regression.at
index ceb18b9..b3fdc29 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1367,11 +1367,11 @@ AT_DATA_GRAMMAR([input.y],
      large enough to overflow size_t.  */
   #define YYSIZE_T unsigned char
 
-  /* Bring in malloc and set _STDLIB_H so yacc.c doesn't try to
+  /* Bring in malloc and set EXIT_SUCCESS so yacc.c doesn't try to
      provide a malloc prototype using our YYSIZE_T.  */
   #include <stdlib.h>
-  #ifndef _STDLIB_H
-  # define _STDLIB_H 1
+  #ifndef EXIT_SUCCESS
+  # define EXIT_SUCCESS 0
   #endif
 
   /* Max depth is usually much smaller than YYSTACK_ALLOC_MAXIMUM, and
-- 
1.7.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]