From: Lena Olson Date: Tue, 18 Jun 2013 21:58:52 +0000 (-0500) Subject: ruby: fix slicc compiler to complain about duplicate symbols X-Git-Tag: stable_2013_10_14~37 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb1279ff497c773d1dc04a8f81f011e8128b47be;p=gem5.git ruby: fix slicc compiler to complain about duplicate symbols Previously, .sm files were allowed to use the same name for a type and a variable. This is unnecessarily confusing and has some bad side effects, like not being able to declare later variables in the same scope with the same type. This causes the compiler to complain and die on things like Address Address. Committed by: Nilay Vaish --- diff --git a/src/mem/slicc/symbols/SymbolTable.py b/src/mem/slicc/symbols/SymbolTable.py index 43cfe8740..48a7ec8d2 100644 --- a/src/mem/slicc/symbols/SymbolTable.py +++ b/src/mem/slicc/symbols/SymbolTable.py @@ -68,6 +68,11 @@ class SymbolTable(object): if id in self.sym_map_vec[-1]: sym.error("Symbol '%s' redeclared in same scope.", id) + for sym_map in self.sym_map_vec: + if id in sym_map: + if type(self.sym_map_vec[0][id]) != type(sym): + sym.error("Conflicting declaration of Symbol '%s'", id) + # FIXME - warn on masking of a declaration in a previous frame self.sym_map_vec[-1][id] = sym