bison-patches
[Top][All Lists]
Advanced

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

fix yet another C++ problem with yacc.c (Debian bug 340012)


From: Paul Eggert
Subject: fix yet another C++ problem with yacc.c (Debian bug 340012)
Date: Thu, 16 Feb 2006 16:11:11 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

I installed this:

2006-02-16  Paul Eggert  <address@hidden>

        * data/yacc.c [(! defined yyoverflow || YYERROR_VERBOSE) && !
        YYSTACK_USE_ALLOCA && ! defined YYSTACK_ALLOC && defined
        __cplusplus && ! defined _STDLIB_H && !
        ((defined YYMALLOC || defined malloc) && (defined YYFREE ||
        defined free))]: Include <stdlib.h> rather than rolling our own
        declarations of malloc and free, to avoid problems with
        incompatible declarations (using 'throw') in C++'s stdlib.h.
        This should fix Debian bug 340012
        <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340012>,
        reported by Guillaume Melquiond.

--- data/yacc.c 23 Jan 2006 08:39:52 -0000      1.133
+++ data/yacc.c 17 Feb 2006 00:08:17 -0000      1.134
@@ -338,8 +338,13 @@ typedef short int yytype_int16;
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  ifdef __cplusplus
-extern "C" {
+#  if (defined __cplusplus && ! defined _STDLIB_H \
+       && ! ((defined YYMALLOC || defined malloc) \
+            && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef _STDLIB_H
+#    define _STDLIB_H 1
+#   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
@@ -353,9 +358,6 @@ void *malloc (YYSIZE_T); /* INFRINGES ON
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
-#  ifdef __cplusplus
-}
-#  endif
 # endif
 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
 




reply via email to

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