summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast
diff options
context:
space:
mode:
authorDavid Hashe <david.hashe@amd.com>2015-07-20 09:15:18 -0500
committerDavid Hashe <david.hashe@amd.com>2015-07-20 09:15:18 -0500
commit93242399227ba2dce443dee108b57f660b39b971 (patch)
tree036d9eacceb19ed661299e27b5665f0ed1dcd822 /src/mem/slicc/ast
parent1850ed410fc85d7ac367dc7b378e5509d62ed900 (diff)
downloadgem5-93242399227ba2dce443dee108b57f660b39b971.tar.xz
slicc: support for local variable declarations in action blocks
Diffstat (limited to 'src/mem/slicc/ast')
-rw-r--r--src/mem/slicc/ast/ExprStatementAST.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mem/slicc/ast/ExprStatementAST.py b/src/mem/slicc/ast/ExprStatementAST.py
index acb69f799..6c77522c7 100644
--- a/src/mem/slicc/ast/ExprStatementAST.py
+++ b/src/mem/slicc/ast/ExprStatementAST.py
@@ -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 @@ class ExprStatementAST(StatementAST):
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)