return flag to indicate errors
authorbdemsky <bdemsky>
Fri, 8 Sep 2006 01:05:42 +0000 (01:05 +0000)
committerbdemsky <bdemsky>
Fri, 8 Sep 2006 01:05:42 +0000 (01:05 +0000)
Repair/RepairCompiler/MCC/CRuntime/tmap.c
Repair/RepairCompiler/MCC/IR/RepairGenerator.java

index 25788a6..6cf599a 100755 (executable)
 #endif
 
 struct typemap * allocatetypemap() {
-  struct typemap *thisvar=(struct typemap *) malloc(sizeof(struct typemap));
 #ifdef CHECKTYPE||CHECKMEMORY
+  struct typemap *thisvar=(struct typemap *) malloc(sizeof(struct typemap));
   thisvar->alloctree=rbinit();
   thisvar->typetree=rbinit();
   thisvar->low=GC_linux_stack_base();
-#endif
   return thisvar;
+#else
+  return NULL;
+#endif
 }
 
 void freefunction(void *ptr) {
@@ -32,20 +34,24 @@ void freetypemap(struct typemap * ptr) {
 }
 
 void typemapreset(struct typemap *ptr) {
+#ifdef CHECKTYPE||CHECKMEMORY
   rbdestroy(ptr->typetree,freefunction);
   ptr->typetree=rbinit();
   if (ptr->low<ptr->high)
     rbdelete(ptr->low,ptr->alloctree);
   else
     rbdelete(ptr->high,ptr->alloctree);
+#endif
 }
 
 void initializetypemapstack(struct typemap * ptr, void *high) {
+#ifdef CHECKTYPE||CHECKMEMORY
   ptr->high=high;
   if (ptr->low<ptr->high)
     rbinsert(ptr->low,ptr->high,NULL,ptr->alloctree);
   else
     rbinsert(ptr->high,ptr->low,NULL,ptr->alloctree);
+#endif
 }
 
 struct structuremap * allocatestructuremap(int s) {
index 8d095b6..35925f3 100755 (executable)
@@ -107,6 +107,7 @@ public class RepairGenerator {
         generate_teardown();
        CodeWriter crhead = new StandardCodeWriter(this.outputhead);
        craux = new StandardCodeWriter(this.outputaux);
+       craux.outputline("return noerrors;");
        craux.emptyBuffer();
        craux.endblock();
 
@@ -544,10 +545,12 @@ public class RepairGenerator {
            craux.outputline("int abstractcount;");
        }
 
-       crhead.outputline("void doanalysis"+postfix+"(struct "+name+"_state *);");
-       craux.outputline("void doanalysis"+postfix+"(struct "+name+"_state * thisvar)");
+       crhead.outputline("int doanalysis"+postfix+"(struct "+name+"_state *);");
+       craux.outputline("int doanalysis"+postfix+"(struct "+name+"_state * thisvar)");
+
        craux.startblock();
        craux.outputline("int highmark;"); /* This declaration is special...need it to be first */
+       craux.outputline("int noerrors=1;");
        craux.startBuffer();
 
        if (Compiler.TIME) {
@@ -931,11 +934,13 @@ public class RepairGenerator {
                 cr.outputline("if (maybe)");
                 cr.startblock();
                 cr.outputline("printf(\"maybe fail " +  escape(constraint.toString()) + ". \\n\");");
+               cr.outputline("noerrors=0;");
                //cr.outputline("exit(1);");
                 cr.endblock();
 
                 cr.outputline("else if (!" + constraintboolean.getSafeSymbol() + ")");
                 cr.startblock();
+               cr.outputline("noerrors=0;");
                 if (!Compiler.REPAIR||Compiler.GENERATEDEBUGHOOKS)
                    cr.outputline("printf(\"fail " + escape(constraint.toString()) + ". \\n\");");