Skip to content

Commit

Permalink
Fix listAppend warnings.
Browse files Browse the repository at this point in the history
- Fix or disable all listAppend warnings to make it possible to see the
  actual compilation errors when compiling omc.
  • Loading branch information
perost authored and adrpo committed Sep 28, 2020
1 parent 142695b commit c0e8727
Show file tree
Hide file tree
Showing 44 changed files with 442 additions and 473 deletions.
6 changes: 3 additions & 3 deletions OMCompiler/Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -494,8 +494,8 @@ algorithm
outREqns := listAppend(List.map1(reqns, BackendEquation.setEquationAttributes, eq_attrs), outREqns);
else
(eqns, reqns) := lowerWhenEqn(el, inFunctions, {}, {});
outEqns := listAppend(outEqns, eqns);
outREqns := listAppend(outREqns, reqns);
outEqns := listAppend(outEqns, eqns) annotation(__OpenModelica_DisableListAppendWarning=true);
outREqns := listAppend(outREqns, reqns) annotation(__OpenModelica_DisableListAppendWarning=true);
end if;
then
();
Expand Down Expand Up @@ -670,7 +670,7 @@ algorithm
case (DAE.CALL(Absyn.IDENT("sample"), es as {start, interval}, attr), (ht, iDelay, iSample, timeEvents))
guard (not Types.isClockOrSubTypeClock(Expression.typeof(interval))) equation
iSample = iSample+1;
timeEvents = listAppend(timeEvents, {BackendDAE.SAMPLE_TIME_EVENT(iSample, start, interval)});
timeEvents = List.appendElt(BackendDAE.SAMPLE_TIME_EVENT(iSample, start, interval), timeEvents);
ht = BaseHashTable.add((inExp, iSample), ht);
then (DAE.CALL(Absyn.IDENT("sample"), DAE.ICONST(iSample)::es, attr), (ht, iDelay, iSample, timeEvents));

Expand Down
10 changes: 5 additions & 5 deletions OMCompiler/Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -2326,9 +2326,9 @@ algorithm
explst = ExpressionSimplify.simplifyList(explst);
// simplify if equation
(acc,asserts1) = simplifyIfEquation(explst,eqnslstlst,eqnslst,{},{},source,globalKnownVars,acc,attr);
asserts = listAppend(asserts,asserts1);
asserts1 = listAppend(asserts,asserts1);
then
(acc, asserts, true);
(acc, asserts1, true);

case (eqn,globalKnownVars)
equation
Expand Down Expand Up @@ -2417,7 +2417,7 @@ algorithm
eqnslst = listReverse(theneqns1);
// simplify nested if equations
((elseenqs1,asserts,_)) = List.fold31(listReverse(elseenqs), simplifyIfEquationsFinder, globalKnownVars, {},{},false);
elseenqs1 = listAppend(elseenqs1,asserts);
elseenqs1 = listAppend(elseenqs1,asserts) annotation(__OpenModelica_DisableListAppendWarning=true);
(eqnslst,elseenqs1,asserts) = simplifyIfEquationAsserts(explst,eqnslst,elseenqs1,{},{},{});
eqns = simplifyIfEquation1(explst,eqnslst,elseenqs1,source,globalKnownVars,inEqns,inEqAttr);
then
Expand All @@ -2436,7 +2436,7 @@ algorithm
eqnslst = listReverse(theneqns1);
// simplify nested if equations
((elseenqs1,asserts,_)) = List.fold31(listReverse(eqns), simplifyIfEquationsFinder, globalKnownVars, {},{},false);
elseenqs1 = listAppend(elseenqs1,asserts);
elseenqs1 = listAppend(elseenqs1,asserts) annotation(__OpenModelica_DisableListAppendWarning=true);
(eqnslst,elseenqs1,asserts) = simplifyIfEquationAsserts(explst,eqnslst,elseenqs1,{},{},{});
eqns = simplifyIfEquation1(explst,eqnslst,elseenqs1,source,globalKnownVars,inEqns,inEqAttr);
then
Expand All @@ -2452,7 +2452,7 @@ algorithm
equation
// simplify nested if equations
((eqns,asserts,_)) = List.fold31(listReverse(eqns), simplifyIfEquationsFinder, globalKnownVars, {},{},false);
eqns = listAppend(eqns,asserts);
eqns = listAppend(eqns,asserts) annotation(__OpenModelica_DisableListAppendWarning=true);
(eqns,asserts) = simplifyIfEquation(explst,eqnslst,elseenqs,e::conditions1,eqns::theneqns1,source,globalKnownVars,inEqns,inEqAttr);
then
(eqns,asserts);
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -1843,7 +1843,7 @@ algorithm
end if;
indx_lst_v := BackendVariable.getVarIndexFromVariables(iVars, v);

indx_lst_v := listAppend(indx_lst_v, statevarindx_lst) "overestimate";
indx_lst_v := listAppend(indx_lst_v, statevarindx_lst) "overestimate" annotation(__OpenModelica_DisableListAppendWarning=true);
indx_lst_e := List.map1r(indx_lst_v, arrayGet, ass1);

indx_arr := arrayCreate(equationArraySizeDAE(iSyst), 0);
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/Compiler/BackEnd/BackendDump.mo
Expand Up @@ -4206,8 +4206,8 @@ algorithm
//gather equations ans variables
(eqIdcs,varIdcsLst,_) = List.map_3(innerEquations, BackendDAEUtil.getEqnAndVarsFromInnerEquation);
varIdcs = List.flatten(varIdcsLst);
eqIdcs = listAppend(eqIdcs, rEqIdcs);
varIdcs = listAppend(varIdcs, tVarIdcs);
eqIdcs = listAppend(eqIdcs, rEqIdcs) annotation(__OpenModelica_DisableListAppendWarning=true);
varIdcs = listAppend(varIdcs, tVarIdcs) annotation(__OpenModelica_DisableListAppendWarning=true);
compEqLst = List.map1(eqIdcs,List.getIndexFirst,eqsIn);
compVarLst = List.map1(varIdcs,List.getIndexFirst,varsIn);
compVars = BackendVariable.listVar1(compVarLst);
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/Compiler/BackEnd/BackendVarTransform.mo
Expand Up @@ -2456,8 +2456,8 @@ algorithm
Boolean b,b1,b2;
case (DAE.BCONST(true),statementLst,_,_,es,repl,_,_,_)
equation
statementLst = listAppend(statementLst,es);
(es_1,b) = replaceStatementLst(statementLst, repl,inFuncTypeExpExpToBooleanOption,inAcc,true);
statementLst_1 = listAppend(statementLst,es);
(es_1,b) = replaceStatementLst(statementLst_1, repl,inFuncTypeExpExpToBooleanOption,inAcc,true);
then (es_1,b);
case (DAE.BCONST(false),_,DAE.NOELSE(),_,es,repl,_,_,_)
equation
Expand Down
12 changes: 6 additions & 6 deletions OMCompiler/Compiler/BackEnd/CommonSubExpression.mo
Expand Up @@ -2175,10 +2175,10 @@ algorithm
//print("is equal\n");
// build CSE
sharedVarIdcs = List.map1(sharedVarIdcs, List.getIndexFirst, varMap);
varIdcs1 = listAppend(varIdcs1, varIdcs2);
varIdcs1 = List.map1(varIdcs1, List.getIndexFirst, varMap);
varIdcs2 = listAppend(varIdcs1, varIdcs2);
varIdcs2 = List.map1(varIdcs2, List.getIndexFirst, varMap);
eqIdcs = List.map1(partition, List.getIndexFirst, eqMap);
then ASSIGNMENT_CSE(eqIdcs, sharedVarIdcs, varIdcs1)::cseIn;
then ASSIGNMENT_CSE(eqIdcs, sharedVarIdcs, varIdcs2)::cseIn;
else cseIn;
end matchcontinue;
end getCSE2;
Expand Down Expand Up @@ -2242,12 +2242,12 @@ algorithm
eqMapArr := listArray(eqMap);
varMapArr := listArray(varMap);
sharedVarIdcs := list(arrayGet(varMapArr, i) for i in sharedVarIdcs);
varIdcs1 := listAppend(varIdcs1, varIdcs2);
varIdcs1 := list(arrayGet(varMapArr, i) for i in varIdcs1);
varIdcs2 := listAppend(varIdcs1, varIdcs2);
varIdcs2 := list(arrayGet(varMapArr, i) for i in varIdcs2);
eqIdcs := list(arrayGet(eqMapArr,i) for i in loop1);
GC.free(eqMapArr);
GC.free(varMapArr);
cseLst := ASSIGNMENT_CSE(eqIdcs, sharedVarIdcs, varIdcs1)::cseLst;
cseLst := ASSIGNMENT_CSE(eqIdcs, sharedVarIdcs, varIdcs2)::cseLst;
end if;
end for;
then cseLst;
Expand Down
31 changes: 15 additions & 16 deletions OMCompiler/Compiler/BackEnd/DataReconciliation.mo
Expand Up @@ -239,10 +239,10 @@ algorithm
end if;

/* Merge E-BLT blocks with S-BLT */
s_BLTBlocks := listAppend(s_BLTBlocks, e_BLTBlocks); // append the E-BLT blocks to the end with S-BLT
s_BLTBlockRanks := listAppend(s_BLTBlockRanks, e_BLTBlockRanks); // append E-BLT block ranks with S-BLT block ranks
sBltAdjacencyMatrix := listAppend(sBltAdjacencyMatrix, eBltAdjacencyMatrix); // append the E-BLT Adjacency matrix with S-BLT Adjacency matrix
solvedEqsAndVarsInfo := listAppend(solvedEqsAndVarsInfo, e_BLTSolvedEqsAndVars); // append the E-BLT Solved Equations and Vars to S-BLT vars
s_BLTBlocks := listAppend(s_BLTBlocks, e_BLTBlocks) annotation(__OpenModelica_DisableListAppendWarning=true); // append the E-BLT blocks to the end with S-BLT
s_BLTBlockRanks := listAppend(s_BLTBlockRanks, e_BLTBlockRanks) annotation(__OpenModelica_DisableListAppendWarning=true); // append E-BLT block ranks with S-BLT block ranks
sBltAdjacencyMatrix := listAppend(sBltAdjacencyMatrix, eBltAdjacencyMatrix) annotation(__OpenModelica_DisableListAppendWarning=true); // append the E-BLT Adjacency matrix with S-BLT Adjacency matrix
solvedEqsAndVarsInfo := listAppend(solvedEqsAndVarsInfo, e_BLTSolvedEqsAndVars) annotation(__OpenModelica_DisableListAppendWarning=true); // append the E-BLT Solved Equations and Vars to S-BLT vars


if debug then
Expand Down Expand Up @@ -293,7 +293,7 @@ algorithm
// update the exactEquation vars
exactEquationVars := List.setDifferenceOnTrue(exactEquationVars, boundaryConditionTaggedEquationSolvedVars, intEq);
// update the boundaryCondtions vars
boundaryConditionVars := listAppend(boundaryConditionVars, boundaryConditionTaggedEquationSolvedVars);
boundaryConditionVars := listAppend(boundaryConditionVars, boundaryConditionTaggedEquationSolvedVars) annotation(__OpenModelica_DisableListAppendWarning=true);

if debug then
print("\nUpdatedVariablesCategories\n=============================");
Expand Down Expand Up @@ -861,14 +861,15 @@ end ExtractEquationsUsingSetOperations;

public function filterTargetBlocksWithoutRanks
input list<tuple<list<Integer>, Integer>> targetBlocks;
input output list<Integer> outBlocks;
input list<Integer> inBlocks;
output list<Integer> outBlocks;
protected
list<Integer> mainBlocks;
list<Integer> mainBlocks = {};
algorithm
for blocks in targetBlocks loop
(mainBlocks, _) := blocks;
outBlocks := listAppend(outBlocks, mainBlocks);
mainBlocks := List.append_reverse(Util.tuple21(blocks), mainBlocks);
end for;
outBlocks := listAppend(inBlocks, listReverse(mainBlocks));
end filterTargetBlocksWithoutRanks;

public function setEBLTEquationsWithIndexAndRank
Expand Down Expand Up @@ -1258,8 +1259,7 @@ algorithm
print("\nFIND Blocks target of :" + anyString(i) + "\n========================");
end if;
(targetblocks, eBLTBlocks) := findBlockTargetsHelper({i}, inlist2, solvedvariables, mxt, inlist1, debug);
targetblocks := listAppend({i}, targetblocks);
targetblocks := listAppend(targetblocks, eBLTBlocks); // append the EBLT blocks to end
targetblocks := listAppend(i :: targetblocks, eBLTBlocks); // append the EBLT blocks to end
//print("\n Final Target Blocks before :" + anyString(targetblocks) + "==>EBLT "+ anyString(eBLTBlocks) +"\n **************\n");
(updatedblocks, ranklist) := findBlocksRanks(blockranks, targetblocks);
updatedblocks := sortBlocks(ranklist, updatedblocks);
Expand Down Expand Up @@ -1328,8 +1328,8 @@ algorithm
for i in inlist loop
(tmpSBLT, tmpEBLT) := getDependencyequation(i, {}, solvedvariables, mxt);
//print("\n Dependencyequations:" + anyString(i) + "=====>" + anyString(tmpSBLT) + "===> EBLT" + anyString(tmpEBLT) + "\n");
outSBLT := listAppend(outSBLT, tmpSBLT);
outEBLT := listAppend(outEBLT, {tmpEBLT});
outSBLT := listAppend(outSBLT, tmpSBLT) annotation(__OpenModelica_DisableListAppendWarning=true);
outEBLT := List.appendElt(tmpEBLT, outEBLT);
/*for v in listReverse(dependencyequations) loop
outlist:=v::outlist;
end for;*/
Expand Down Expand Up @@ -1417,9 +1417,8 @@ algorithm
end for;
end for;
outlist := listReverse(outlist);
ranklist := List.sort(s_BLTRanks, intGt);
// append the EBLT Blocks ranks always to last
ranklist := listAppend(ranklist, listReverse(e_BLTRanks));
ranklist := listAppend(List.sort(s_BLTRanks, intGt), listReverse(e_BLTRanks));
end findBlocksRanks;

public function sortBlocks
Expand Down Expand Up @@ -1856,4 +1855,4 @@ algorithm
end dumpEquationString;

annotation(__OpenModelica_Interface="backend");
end DataReconciliation;
end DataReconciliation;

0 comments on commit c0e8727

Please sign in to comment.