]> git.saurik.com Git - bison.git/commitdiff
glr.c: omit yyresolveLocations when locations are disabled.
authorJoel E. Denny <joeldenny@joeldenny.org>
Sat, 16 Apr 2011 22:15:40 +0000 (18:15 -0400)
committerJoel E. Denny <joeldenny@joeldenny.org>
Sat, 16 Apr 2011 22:29:10 +0000 (18:29 -0400)
This prevents gcc 4.6.0's -Wunused-but-set-variable from warning
about yyresolveLocations's local yyrhsloc.  When locations are
enabled, there's no such warning because YYLLOC_DEFAULT then uses
yyrhsloc.  Reported by Jim Meyering at
<http://lists.gnu.org/archive/html/bug-bison/2011-04/msg00002.html>.
* data/glr.c (yyresolveLocations): Omit definition when locations
are disabled.
(yyresolveValue): Omit yyresolveLocations invocation when
locations are disabled.
(cherry picked from commit 55dd35633675f588c58ead46ecd6b5f4db504192)

ChangeLog
data/glr.c

index 63a50100cbdf741db27a8a0ff23cce6477eb49e7..fa6198ca8fc0990395220c6f7c3f07ed67ecf463 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-04-16  Joel E. Denny  <joeldenny@joeldenny.org>
+
+       glr.c: omit yyresolveLocations when locations are disabled.
+       This prevents gcc 4.6.0's -Wunused-but-set-variable from warning
+       about yyresolveLocations's local yyrhsloc.  When locations are
+       enabled, there's no such warning because YYLLOC_DEFAULT then uses
+       yyrhsloc.  Reported by Jim Meyering at
+       <http://lists.gnu.org/archive/html/bug-bison/2011-04/msg00002.html>.
+       * data/glr.c (yyresolveLocations): Omit definition when locations
+       are disabled.
+       (yyresolveValue): Omit yyresolveLocations invocation when
+       locations are disabled.
+
 2011-04-16  Joel E. Denny  <joeldenny@joeldenny.org>
 
        gnulib, autoconf: update.
index 807d67d77c39bbae598a22b088b9ceee81b5f2f1..f22a8f103a5df9cae1f03dbf49a978c1053768b0 100644 (file)
@@ -1757,7 +1757,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
 
   yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
   return yyabort;
-}
+}]b4_locations_if([[
 
 /** Resolve the locations for each of the YYN1 states in *YYSTACKP,
  *  ending at YYS1.  Has no effect on previously resolved states.
@@ -1815,7 +1815,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
          yylloc = yylloc_current;
        }
     }
-}
+}]])[
 
 /** Resolve the ambiguity represented in state YYS in *YYSTACKP,
  *  perform the indicated actions, and set the semantic value of YYS.
@@ -1850,8 +1850,8 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
        {
          switch (yypreference (yybest, yyp))
            {
-           case 0:
-             yyresolveLocations (yys, 1, yystackp]b4_user_args[);
+           case 0:]b4_locations_if([[
+             yyresolveLocations (yys, 1, yystackp]b4_user_args[);]])[
              return yyreportAmbiguity (yybest, yyp]b4_pure_args[);
              break;
            case 1: