[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bison patches to avoid GCC 2.95.4 warnings
From: |
Paul Eggert |
Subject: |
Bison patches to avoid GCC 2.95.4 warnings |
Date: |
Tue, 03 Jun 2003 22:58:04 -0700 |
I installed this:
2003-06-03 Paul Eggert <address@hidden>
Avoid warnings generated by GCC 2.95.4 when Bison is
configured with --enable-gcc-warnings.
* data/lalr1.cc (yy::]b4_parser_class_name[::parse,
yy::]b4_parser_class_name[::translate_,
yy::Stack::operator[] (unsigned),
yy::Stack::operator[] (unsigned) const,
yy::Slice::operator[] (unsigned),
yy::Slice::operator[] (unsigned) const):
Rename local vars to avoid warnings.
* tests/glr-regression.at (Improper handling of embedded actions
and $-N in GLR parsers): Remove unused local variable from yylex.
* tests/regression.at (_AT_DATA_DANCER_Y): Declare yylex to take
(void) as arg when not pure, since we now assume C89 when building
Bison. Pacify GCC by using parameter.
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.33
diff -p -u -r1.33 lalr1.cc
--- data/lalr1.cc 2 Jun 2003 08:19:08 -0000 1.33
+++ data/lalr1.cc 4 Jun 2003 05:28:48 -0000
@@ -544,11 +544,11 @@ b4_syncline(address@hidden@], address@hidden@])[
if (count < 5)
{
count = 0;
- for (int x = xbegin; x < xend; ++x)
- if (check_[x + n_] == x && x != terror_)
+ for (int x1 = xbegin; x1 < xend; ++x1)
+ if (check_[x1 + n_] == x1 && x1 != terror_)
{
message += (!count++) ? ", expecting " : " or ";
- message += name_[x];
+ message += name_[x1];
}
}
}
@@ -792,12 +792,12 @@ yy::]b4_parser_class_name[::translate_ (
{
static
const TokenNumberType
- translate_[] =
+ translate_table[] =
{
]b4_translate[
};
if ((unsigned) token <= user_token_number_max_)
- return translate_[token];
+ return translate_table[token];
else
return undef_token_;
}
@@ -844,16 +844,16 @@ namespace yy
inline
T&
- operator [] (unsigned index)
+ operator [] (unsigned i)
{
- return seq_[index];
+ return seq_[i];
}
inline
const T&
- operator [] (unsigned index) const
+ operator [] (unsigned i) const
{
- return seq_[index];
+ return seq_[i];
}
inline
@@ -899,9 +899,9 @@ namespace yy
inline
const T&
- operator [] (unsigned index) const
+ operator [] (unsigned i) const
{
- return stack_[range_ - index];
+ return stack_[range_ - i];
}
private:
Index: tests/glr-regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/glr-regression.at,v
retrieving revision 1.1
diff -p -u -r1.1 glr-regression.at
--- tests/glr-regression.at 29 Jan 2003 23:39:11 -0000 1.1
+++ tests/glr-regression.at 4 Jun 2003 05:29:05 -0000
@@ -173,7 +173,6 @@ FILE *yyin = NULL;
int
yylex (void)
{
- int c;
char buf[50];
switch (fscanf (yyin, " %1[a-z,]", buf)) {
case 1:
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.80
diff -p -u -r1.80 regression.at
--- tests/regression.at 18 Apr 2003 07:26:46 -0000 1.80
+++ tests/regression.at 4 Jun 2003 05:29:06 -0000
@@ -675,11 +675,10 @@ AT_CLEANUP
m4_define([_AT_DATA_DANCER_Y],
[AT_DATA_GRAMMAR([dancer.y],
[%{
-AT_LALR1_CC_IF(
-[static int yylex (int *lval);],
+static int yylex (AT_LALR1_CC_IF([int *], [void]));
+AT_LALR1_CC_IF([],
[#include <stdio.h>
-static void yyerror (const char *s);
-static int yylex ();])
+static void yyerror (const char *);])
%}
$1
%token ARROW INVALID NUMBER STRING DATA
@@ -753,13 +752,14 @@ yyerror (const char *s)
}])
static int
-yylex (AT_LALR1_CC_IF([int *lval]))
+yylex (AT_LALR1_CC_IF([int *lval], [void]))
[{
static int toknum = 0;
int tokens[] =
{
':', -1
};
+ ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
return tokens[toknum++];
}]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bison patches to avoid GCC 2.95.4 warnings,
Paul Eggert <=