bison-patches
[Top][All Lists]
Advanced

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

[PATCH] Make glr.c a bit more G++ friendly


From: Paul Hilfinger
Subject: [PATCH] Make glr.c a bit more G++ friendly
Date: Tue, 07 Jun 2005 02:58:33 -0000

g++ does not accept __attribute__ ((unused)) for parameters (one
is supposed to simply suppress the parameter name to indicate an
unused parameter in C++).  As a result of earlier changes to glr.c to
suppress unused-xxx warnings, however, there were some uses of
__attribute__ ((unused)) for parameters.  I've applied the following
patch, which removes them.  (gmake check successful).

Paul Hilfinger

ChangeLog:

2005-06-06  Paul Hilfinger  <address@hidden>

        * data/glr.c: Modify treatment of unused parameters to permit use
        of g++ (which doesn't allow __attribute__ ((unused)) for parameters).


Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.93
diff -u -p -r1.93 glr.c
--- data/glr.c  22 May 2005 06:26:13 -0000      1.93
+++ data/glr.c  7 Jun 2005 02:45:53 -0000
@@ -245,6 +245,13 @@ b4_syncline(address@hidden@], address@hidden@])
 # if !defined (__GNUC__) || __GNUC__ < 2 || \
 (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
 #  define __attribute__(Spec) /* empty */
+# else
+]b4_location_if([#  define YYOPTIONAL_LOC(Name) Name],[
+#  if defined (__cplusplus)
+#   define YYOPTIONAL_LOC(Name) /* empty */
+#  else
+#   define YYOPTIONAL_LOC(Name) Name ATTRIBUTE_UNUSED
+#  endif])[
 # endif
 #endif
 
@@ -719,7 +726,7 @@ yyfill (yyGLRStackItem *yyvsp, int *yylo
 static YYRESULTTAG
 yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
              YYSTYPE* yyvalp,
-             YYLTYPE* yylocp]b4_location_if(, [ ATTRIBUTE_UNUSED])[,
+             YYLTYPE* YYOPTIONAL_LOC (yylocp),
              yyGLRStack* yystack
               ]b4_user_formals[)
 {
@@ -1748,7 +1755,7 @@ yyreportSyntaxError (yyGLRStack* yystack
 static void
 yyrecoverSyntaxError (yyGLRStack* yystack,
                      YYSTYPE* yylvalp,
-                     YYLTYPE* yyllocp]b4_location_if(, [ ATTRIBUTE_UNUSED])[
+                     YYLTYPE* YYOPTIONAL_LOC (yyllocp)
                      ]b4_user_formals[)
 {
   yySymbol* const yytokenp = yystack->yytokenp;





reply via email to

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