edits
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / codeGenerator / CodeVariables.java
index 7e4ab29..b9ab022 100644 (file)
@@ -467,8 +467,13 @@ public class CodeVariables {
 
                // Define the __SPEC_CLEAN__ function for clean-up
                newCode.add(COMMENT("Cleanup routine of sequential variables"));
-               newCode.add("static void __SPEC_CLEANUP__() {");
-               addAllCodeWithIndent(newCode, construct.code.cleanupCode, "\t");
+               newCode.add("static bool __SPEC_CLEANUP__() {");
+               if (construct.code.cleanupCode.size() > 0) {
+                       addAllCodeWithIndent(newCode, construct.code.cleanupCode, "\t");        
+               } else {
+                       newCode.add("\treturn true;"); // If not specified return true
+               }
+               
                newCode.add("}");
                newCode.add("");
 
@@ -504,10 +509,10 @@ public class CodeVariables {
                newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_INIT, structName));
                newCode.add("\t"
                                + ASSIGN_TO_PTR(structName, "init_func",
-                                               "(void_func_t*) __SPEC_INIT__"));
+                                               "(void*) __SPEC_INIT__"));
                newCode.add("\t"
                                + ASSIGN_TO_PTR(structName, "cleanup_func",
-                                               "(void_func_t*) __SPEC_CLEANUP__"));
+                                               "(void*) __SPEC_CLEANUP__"));
                newCode.add("\t"
                                + ASSIGN_TO_PTR(structName, "func_table", "func_ptr_table"));
                newCode.add("\t"