]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
When yydebug, report semantic and location values for reductions.
[bison.git] / data / lalr1.cc
index 565228b64d6c987b7957a97762898b5405b39b2f..91360a529944002fae3f6506672f1a9258f0178e 100644 (file)
@@ -30,7 +30,6 @@ m4_if(b4_defines_flag, 0, [],
 b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
              [2002, 2003, 2004, 2005])
 dnl FIXME: This is wrong, we want computed header guards.
-dnl FIXME: I do not know why the macros are missing now. :(
 [
 #ifndef PARSER_HEADER_H
 # define PARSER_HEADER_H
@@ -88,7 +87,7 @@ do {                                                  \
     {                                                  \
       (Current).begin = (Current).end = (Rhs)[0].end;  \
     }                                                  \
-} while (0)
+} while (false)
 #endif
 
 namespace yy
@@ -319,6 +318,9 @@ b4_syncline([@oline@], [@ofile@])[
 # endif
 #endif
 
+/* Suppress unused-variable warnings by "using" E.  */
+#define YYUSE(e) do {;} while (false && (e))
+
 /* A pseudo ostream that takes yydebug_ into account. */
 # define YYCDEBUG                                                      \
   for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false)       \
@@ -335,19 +337,19 @@ do {                                                      \
       yysymprint_ ((Type), (Value), (Location));       \
       *yycdebug_ << std::endl;                         \
     }                                                  \
-} while (0)
+} while (false)
 
 # define YY_REDUCE_PRINT(Rule)         \
 do {                                   \
   if (yydebug_)                                \
     yyreduce_print_ (Rule);            \
-} while (0)
+} while (false)
 
 # define YY_STACK_PRINT()              \
 do {                                   \
   if (yydebug_)                                \
     yystack_print_ ();                 \
-} while (0)
+} while (false)
 
 #else /* !YYDEBUG */
 
@@ -411,12 +413,12 @@ void
 yy::]b4_parser_class_name[::yysymprint_ (int yytype,
                          const semantic_type* yyvaluep, const location_type* yylocationp)
 {
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yyvaluep;
-  (void) yylocationp;
   /* Backward compatibility, but should be removed eventually. */
   std::ostream& cdebug_ = *yycdebug_;
-  (void) cdebug_;
+
+  YYUSE (!&cdebug_);
+  YYUSE (yylocationp);
+  YYUSE (yyvaluep);
 
   *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
             << ' ' << yytname_[yytype] << " ("
@@ -435,10 +437,9 @@ void
 yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg,
                          int yytype, semantic_type* yyvaluep, location_type* yylocationp)
 {
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yymsg;
-  (void) yyvaluep;
-  (void) yylocationp;
+  YYUSE (yylocationp);
+  YYUSE (yymsg);
+  YYUSE (yyvaluep);
 
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);