# 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
# 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):
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)