changeset 3ed88c8334f1 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=3ed88c8334f1
description:
        slicc: support for local variable declarations in action blocks

diffstat:

 src/mem/slicc/ast/ExprStatementAST.py |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r ea8bdb1d9f1e -r 3ed88c8334f1 src/mem/slicc/ast/ExprStatementAST.py
--- a/src/mem/slicc/ast/ExprStatementAST.py     Mon Jul 20 09:15:18 2015 -0500
+++ b/src/mem/slicc/ast/ExprStatementAST.py     Mon Jul 20 09:15:18 2015 -0500
@@ -1,5 +1,6 @@
 # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
 # Copyright (c) 2009 The Hewlett-Packard Development Company
+# Copyright (c) 2013 Advanced Micro Devices, Inc.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -26,6 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from slicc.ast.StatementAST import StatementAST
+from slicc.ast.LocalVariableAST import LocalVariableAST
 from slicc.symbols import Type
 
 class ExprStatementAST(StatementAST):
@@ -40,8 +42,9 @@
         actual_type,rcode = self.expr.inline(True)
         code("$rcode;")
 
-        # The return type must be void
-        if actual_type != self.symtab.find("void", Type):
+        # The return type must be void, except for local var decls
+        if (not isinstance(self.expr, LocalVariableAST) and
+            actual_type != self.symtab.find("void", Type)):
             self.expr.warning("Non-void return ignored, " + \
                 "return type is '%s'", actual_type.ident)
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to