]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
* TODO: Remove dead items.
[bison.git] / data / yacc.c
index f076c744bf12552d29f575180d5918bdeae692c6..6f847177db3f9f5789bb3fd6fadd17f5b7bd4a1e 100644 (file)
@@ -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 USER NAME SPACE */
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
-#  ifdef __cplusplus
-}
-#  endif
 # endif
 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
 
@@ -1262,7 +1264,7 @@ yyreduce:
 
 ]b4_location_if(
 [[  /* Default location.  */
-  YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);]])[
+  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
@@ -1427,7 +1429,7 @@ yyerrlab1:
   yyerror_range[1] = yylloc;
   /* Using YYLLOC is tempting, but would change the location of
      the look-ahead.  YYLOC is available though.  */
-  YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
+  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
   *++yylsp = yyloc;]])[
 
   /* Shift the error token.  */