Skip to content

Commit

Permalink
- use Error.addCompilerWarning instead of print in BackendDAETransform
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17844 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Oct 23, 2013
1 parent ab7bd52 commit 7531301
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Compiler/BackEnd/BackendDAETransform.mo
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ algorithm
(BackendDAE.EQSYSTEM(vars,eqs,NONE(),NONE(),BackendDAE.MATCHING(ass1,ass2,comps1),stateSets),comps1);
else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function strongComponentsScalar failed
sorting equations (strongComponents) failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function strongComponentsScalar failed
- sorting equations (strongComponents) failed");
then fail();
end matchcontinue;
end strongComponentsScalar;
Expand Down Expand Up @@ -202,7 +202,7 @@ algorithm
analyseStrongComponentsScalar(comps,syst,shared,inAss1,inAss2,mapEqnIncRow,mapIncRowEqn,mark,markarray,acomp::iAcc);
else
equation
print("- BackendDAETransform.analyseStrongComponents failed\n");
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentsScalar failed");
then
fail();
end match;
Expand Down Expand Up @@ -249,7 +249,7 @@ algorithm
(compX,imark+1);
else
equation
print("- BackendDAETransform.analyseStrongComponent failed\n");
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentScalar failed");
then
fail();
end match;
Expand Down Expand Up @@ -310,8 +310,8 @@ algorithm
(BackendDAE.EQSYSTEM(vars,eqs,SOME(m),SOME(mt),BackendDAE.MATCHING(ass1,ass2,comps1),stateSets),comps1);
else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function strongComponents failed
sorting equations (strongComponents) failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function strongComponents failed
- sorting equations (strongComponents) failed");
then fail();
end matchcontinue;
end strongComponents;
Expand Down Expand Up @@ -341,7 +341,7 @@ algorithm
analyseStrongComponents(comps,syst,shared,inAss1,inAss2,acomp::iAcc);
else
equation
print("- BackendDAETransform.analyseStrongComponents failed\n");
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponents failed");
then
fail();
end match;
Expand Down Expand Up @@ -374,7 +374,7 @@ algorithm
compX;
else
equation
print("- BackendDAETransform.analyseStrongComponent failed\n");
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponent failed");
then
fail();
end match;
Expand Down Expand Up @@ -494,13 +494,13 @@ Sorry - Support for Discrete Equation Systems is not yet implemented\n";
msg = msg +& stringDelimitList(slst,"\n");
slst = List.map(eqn_lst,BackendDump.equationString);
msg = msg +& "\n" +& stringDelimitList(slst,"\n");
Error.addMessage(Error.INTERNAL_ERROR, {msg});
Error.addInternalError(msg);
then
fail();

else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentBlock failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentBlock failed");
then
fail();

Expand Down Expand Up @@ -899,8 +899,8 @@ algorithm
then (contEqnLst, contVarLst, discEqnLst, discVarLst, indxcontEqnLst, indxcontVarLst, indxdiscEqnLst, indxdiscVarLst);

case (_, _, _, _) equation
Error.addCompilerWarning(BackendDump.varListString(varLst, "involved variables"));
Error.addCompilerWarning(BackendDump.equationListString(eqnLst, "involved equations"));
Error.addInternalError(BackendDump.varListString(varLst, "involved variables"));
Error.addInternalError(BackendDump.equationListString(eqnLst, "involved equations"));
then fail();
end matchcontinue;
end splitMixedEquations;
Expand Down Expand Up @@ -1548,7 +1548,7 @@ algorithm

else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsEqnWithSymbolicOperation failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsEqnWithSymbolicOperation failed");
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -1696,7 +1696,7 @@ algorithm
(wop::res1,ext_arg_1);
case (_,_,_)
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsWhenOperator failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsWhenOperator failed");
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -1735,7 +1735,7 @@ algorithm
(BackendDAE.WHEN_CLAUSE(cond1,reinitStmtLst1,elsindx)::wclst1,ext_arg_3);
case (_,_,_)
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsWhenClauseLst failed"});
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsWhenClauseLst failed");
then
fail();
end matchcontinue;
Expand Down
13 changes: 13 additions & 0 deletions Compiler/Util/Error.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1134,4 +1134,17 @@ algorithm
end match;
end addCompilerNotification;

public function addInternalError
"Used to make a compiler notification"
input String message;
algorithm
_ := match (message)
case _
equation
addMessage(INTERNAL_ERROR, {message});
then
();
end match;
end addInternalError;

end Error;

0 comments on commit 7531301

Please sign in to comment.