From: bdemsky Date: Fri, 8 Sep 2006 01:05:42 +0000 (+0000) Subject: return flag to indicate errors X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=commitdiff_plain;h=7490e10346ba060181a5ff8072c6828a98730ec2 return flag to indicate errors --- diff --git a/Repair/RepairCompiler/MCC/CRuntime/tmap.c b/Repair/RepairCompiler/MCC/CRuntime/tmap.c index 25788a6..6cf599a 100755 --- a/Repair/RepairCompiler/MCC/CRuntime/tmap.c +++ b/Repair/RepairCompiler/MCC/CRuntime/tmap.c @@ -10,13 +10,15 @@ #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->lowhigh) 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->lowhigh) rbinsert(ptr->low,ptr->high,NULL,ptr->alloctree); else rbinsert(ptr->high,ptr->low,NULL,ptr->alloctree); +#endif } struct structuremap * allocatestructuremap(int s) { diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index 8d095b6..35925f3 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -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\");");