bison-patches
[Top][All Lists]
Advanced

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

Re: bison against GCC -Wundef: one report, and one patch


From: Paul Eggert
Subject: Re: bison against GCC -Wundef: one report, and one patch
Date: 27 Apr 2003 23:07:37 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Gerald Pfeifer <address@hidden> writes:

> When using gcc -Wundef to compile code generated by bison 1.875 most
> of the problems that used to be flagged for earlier versions are gone
> but two remain:
> 
> 1) parser2.c:1482:6: warning: "YYSTACK_USE_ALLOCA" is not defined ...
> 2) parser2.c:2161:5: warning: "YYMAXDEPTH" is not defined

Thanks for reporting this.  I installed the following patch.

2003-04-27  Paul Eggert  <address@hidden>

        Avoid gcc -Wundef warnings reported by Gerald Pfeifer in
        <http://mail.gnu.org/archive/html/bug-bison/2003-04/msg00044.html>.
        * data/yacc.c (YYSTACK_ALLOC): Don't evaluate YYSTACK_USE_ALLOCA
        if it is not defined.
        (YYMAXDEPTH): Don't evaluate YYMAXDEPTH if it is not defined.

--- data/yacc.c 2 Mar 2003 13:39:44 -0000       1.54
+++ data/yacc.c 28 Apr 2003 06:03:58 -0000      1.55
@@ -218,16 +218,16 @@ b4_syncline(address@hidden@], address@hidden@])[
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
-# if YYSTACK_USE_ALLOCA
-#  define YYSTACK_ALLOC alloca
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   define YYSTACK_ALLOC alloca
+#  endif
 # else
-#  ifndef YYSTACK_USE_ALLOCA
-#   if defined (alloca) || defined (_ALLOCA_H)
-#    define YYSTACK_ALLOC alloca
-#   else
-#    ifdef __GNUC__
-#     define YYSTACK_ALLOC __builtin_alloca
-#    endif
+#  if defined (alloca) || defined (_ALLOCA_H)
+#   define YYSTACK_ALLOC alloca
+#  else
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
 #   endif
 #  endif
 # endif
@@ -622,7 +622,7 @@ int yydebug;
    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
    evaluated with infinite-precision integer arithmetic.  */
 
-#if YYMAXDEPTH == 0
+#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
 # undef YYMAXDEPTH
 #endif
 




reply via email to

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