Hi,
        In reponse to the thread begun here:
http://lists.gnu.org/archive/html/help-bison/2007-10/msg00049.html

I've attached a proposed patch for the C parser skeleton (yacc.c) that improves usability with C++ compilation (regarding malloc prototype), even though it is not officially supported. Please consider this patch, or let me know why it cannot be accepted. Thanks.

Fang

David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
http://www.csl.cornell.edu/~fang/
        -- (2400 baud? Netscape 3.0?? lynx??? No problem!)
--- yacc-orig.c 2007-10-20 14:39:28.000000000 -0400
+++ yacc.c      2007-10-20 14:51:21.000000000 -0400
@@ -344,13 +344,24 @@
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
 #   if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[
+#     if defined(__cplusplus)
+       /* in case malloc has exception specification */
+#       include <cstdlib>
+using std::malloc;
+#     else
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#     endif
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
 #   if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[
+#     if defined(__cplusplus)
+#       include <cstdlib>
+using std::free;
+#     else
 void free (void *); /* INFRINGES ON USER NAME SPACE */
+#     endif
 #   endif
 #  endif
 # endif

Reply via email to