[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison patch to avoid "shadows a member of" warning in lalr1.cc
From: |
Paul Eggert |
Subject: |
bison patch to avoid "shadows a member of" warning in lalr1.cc |
Date: |
Mon, 2 Jun 2003 01:22:24 -0700 (PDT) |
I got the following test failures with Bison on Solaris 8 with GCC 3.3,
where Bison was configured with --enable-gcc-warnings:
./testsuite -v -d 80
## ---------------------------- ##
## GNU Bison 1.875b test suite. ##
## ---------------------------- ##
80. calc.at:615: testing Calculator %skeleton lalr1.cc %defines %locations...
calc.at:615: bison -o calc.c calc.y
calc.at:615: $CXX --version || exit 77
stderr:
stdout:
g++ (GCC) 3.3
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
calc.at:615: $CXX $CXXFLAGS $CPPFLAGS calc.c -o calc
stderr:
In file included from location.hh:31,
from calc.h:26,
from calc.c:21:
position.hh: In member function `void yy::Position::lines(int)':
position.hh:61: warning: declaration of `lines' shadows a member of `this'
position.hh: In member function `void yy::Position::columns(int)':
position.hh:68: warning: declaration of `columns' shadows a member of `this'
In file included from calc.h:26,
from calc.c:21:
location.hh: In member function `void yy::Location::columns(unsigned int)':
location.hh:62: warning: declaration of `columns' shadows a member of `this'
location.hh: In member function `void yy::Location::lines(unsigned int)':
location.hh:68: warning: declaration of `lines' shadows a member of `this'
calc.at:615: exit code was 1, expected 0
80. calc.at:615: FAILED near `calc.at:615'
I installed the following patch to work around this problem:
2003-06-02 Paul Eggert <address@hidden>
* data/lalr1.cc (yy::Position::lines, yy::Position::columns,
yy::Location::lines, yy::Location::columns): Rename arguments
to avoid shadowing; this removes a warning generated by GCC 3.3.
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.32
diff -p -u -r1.32 lalr1.cc
--- data/lalr1.cc 14 May 2003 18:41:48 -0000 1.32
+++ data/lalr1.cc 2 Jun 2003 08:13:37 -0000
@@ -954,20 +954,20 @@ namespace yy
/** \name Line and Column related manipulators
** \{ */
public:
- /** \brief (line related) Advance to the LINES next lines. */
- inline void lines (int lines = 1)
+ /** \brief (line related) Advance to the COUNT next lines. */
+ inline void lines (int count = 1)
{
column = initial_column;
- line += lines;
+ line += count;
}
- /** \brief (column related) Advance to the COLUMNS next columns. */
- inline void columns (int columns = 1)
+ /** \brief (column related) Advance to the COUNT next columns. */
+ inline void columns (int count = 1)
{
int leftmost = initial_column;
int current = column;
- if (leftmost <= current + columns)
- column += columns;
+ if (leftmost <= current + count)
+ column += count;
else
column = initial_column;
}
@@ -1068,16 +1068,16 @@ namespace yy
begin = end;
}
- /** \brief Extend the current location to the COLUMNS next columns. */
- inline void columns (unsigned columns = 1)
+ /** \brief Extend the current location to the COUNT next columns. */
+ inline void columns (unsigned int count = 1)
{
- end += columns;
+ end += count;
}
- /** \brief Extend the current location to the LINES next lines. */
- inline void lines (unsigned lines = 1)
+ /** \brief Extend the current location to the COUNT next lines. */
+ inline void lines (unsigned int count = 1)
{
- end.lines (lines);
+ end.lines (count);
}
/** \} */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bison patch to avoid "shadows a member of" warning in lalr1.cc,
Paul Eggert <=