Warn about dubious constructions like "%token T T".

* src/symtab.h (struct symbol.declared): New member.
* src/symtab.c (symbol_new): Initialize it to false.
(symbol_class_set): New arg DECLARING, specifying whether
this is a declaration that we want to warn about, if there
is more than one of them.  All uses changed.
This commit is contained in:
Paul Eggert
2006-01-03 21:31:57 +00:00
parent 1221b78adb
commit 073f92889f
5 changed files with 36 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
/* Definitions for symtab.c and callers, part of Bison.
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004, 2005
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -79,6 +79,7 @@ struct symbol
identifier-symbol pair for an alias. */
symbol *alias;
symbol_class class;
bool declared;
};
/* Undefined user number. */
@@ -121,7 +122,8 @@ void symbol_printer_set (symbol *sym, const char *printer, location loc);
void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc);
/* Set the CLASS associated with SYM. */
void symbol_class_set (symbol *sym, symbol_class class, location loc);
void symbol_class_set (symbol *sym, symbol_class class, location loc,
bool declaring);
/* Set the USER_TOKEN_NUMBER associated with SYM. */
void symbol_user_token_number_set (symbol *sym, int user_number, location loc);