bug-bison
[Top][All Lists]
Advanced

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

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


From: Gerald Pfeifer
Subject: bison against GCC -Wundef: one report, and one patch
Date: Sun, 27 Apr 2003 23:35:20 +0200 (CEST)

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

The problem here is the first line, which should be guarded by
#ifdef YYSTACK_USE_ALLOCA:

  # if YYSTACK_USE_ALLOCA
  #  define YYSTACK_ALLOC alloca
  # else
  #  ifndef YYSTACK_USE_ALLOCA
  #   if defined (alloca) || defined (_ALLOCA_H)
  #    define YYSTACK_ALLOC alloca
  #   else
  #    ifdef __GNUC__
  #     define YYSTACK_ALLOC __builtin_alloca
  #    endif
  #   endif
  #  endif
  # endif

2) parser2.c:2161:5: warning: "YYMAXDEPTH" is not defined

Fixed by the patch below.  (Note that I'm not on this list, so I'd
appreciate a direct copy for any replies.)

Gerald

2003-04-27  Gerald Pfeifer  <address@hidden>

        * data/yacc.c: Check whether YYMAXDEPTH is defined before using
        it.

--- yacc.c.orig Sat Dec 28 09:36:02 2002
+++ yacc.c      Sun Apr 27 23:30:04 2003
@@ -614,8 +614,10 @@ int yydebug;
    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
    evaluated with infinite-precision integer arithmetic.  */

-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
+#ifdef YYMAXDEPTH
+# if YYMAXDEPTH == 0
+#  undef YYMAXDEPTH
+# endif
 #endif

 #ifndef YYMAXDEPTH




reply via email to

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