changeset 82758c79a71f in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=82758c79a71f
description:
        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 <[email protected]>

diffstat:

 src/mem/slicc/symbols/SymbolTable.py |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 488a71df39bc -r 82758c79a71f src/mem/slicc/symbols/SymbolTable.py
--- a/src/mem/slicc/symbols/SymbolTable.py      Tue Jun 18 16:58:33 2013 -0500
+++ b/src/mem/slicc/symbols/SymbolTable.py      Tue Jun 18 16:58:52 2013 -0500
@@ -68,6 +68,11 @@
         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
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to