[Top][All Lists]

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

Re: minor issue in lalr1.cc

From: Akim Demaille
Subject: Re: minor issue in lalr1.cc
Date: Thu, 11 May 2006 08:22:18 +0200

Le 10 mai 06 à 19:32, martin nylin a écrit :

Hi all!

I just checked out the latest sources from CVS and when I use them to build my c++-parser, which I compile with g++ -Wshadow, I get the following warning:

Parser.cc: In member function 'short unsigned int yy::Parser::yytranslate_(int)': Parser.cc:13721: warning: declaration of 'token' shadows a member of 'this'

The reason for this, I think, is that in lalr1.cc in line 132, a struct attribute of the parser is named 'token' and then in line 266, the argument to the method yytranslate is also named 'token'.

Thanks, I have changed that.

2006-05-11  Akim Demaille  <address@hidden>

        * data/lalr1.cc (yytranslate_): Rename token as t to avoid clashes
        with the member "token".
        Reported by Martin Nylin.

Index: data/lalr1.cc
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.126
diff -u -r1.126 lalr1.cc
--- data/lalr1.cc 9 May 2006 06:40:13 -0000 1.126
+++ data/lalr1.cc 11 May 2006 06:16:38 -0000
@@ -262,8 +262,8 @@
     virtual void yystack_print_ ();
-    /// Convert a scanner token number to a symbol number.
-    token_number_type yytranslate_ (int token);
+    /// Convert a scanner token number \a t to a symbol number.
+    token_number_type yytranslate_ (int t);
     /// \brief Reclaim the memory associated to a symbol.
     /// \param yymsg        Why this token is reclaimed.
@@ -1048,7 +1048,7 @@
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-  ]b4_parser_class_name[::yytranslate_ (int token)
+  ]b4_parser_class_name[::yytranslate_ (int t)
     const token_number_type
@@ -1056,8 +1056,8 @@
-    if ((unsigned int) token <= yyuser_token_number_max_)
-      return translate_table[token];
+    if ((unsigned int) t <= yyuser_token_number_max_)
+      return translate_table[t];
       return yyundef_token_;

reply via email to

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