Skip to content

Commit

Permalink
re-added accidentally removed assert warning
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors authored and unknown committed Nov 20, 2015
1 parent 57d05fd commit fb29737
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -11488,7 +11488,7 @@ template whenOperators(list<WhenOperator> whenOps, Context context, Text &varDec
MODELICA_TERMINATE(<%msgVar%>);
>>
case ASSERT(source=SOURCE(info=info)) then
assertCommon(condition, message, contextSimulationDiscrete, &varDecls, info,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
assertCommon(condition, message,level, contextSimulationDiscrete, &varDecls, info,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
case NORETCALL(__) then
let &preExp = buffer ""
let expPart = daeExp(exp, contextSimulationDiscrete, &preExp, &varDecls,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
Expand Down Expand Up @@ -11819,7 +11819,7 @@ end daeExpRange;



template assertCommon(Exp condition, Exp message, Context context, Text &varDecls, builtin.SourceInfo info, SimCode simCode,
template assertCommon(Exp condition, Exp message,Exp level, Context context, Text &varDecls, builtin.SourceInfo info, SimCode simCode,
Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation)
::=
let &preExpCond = buffer ""
Expand All @@ -11843,7 +11843,11 @@ template assertCommon(Exp condition, Exp message, Context context, Text &varDecl
if(!<%condVar%>)
{
<%preExpMsg%>
throw ModelicaSimulationError(MODEL_EQ_SYSTEM,<%msgVar%>);
<%match level case ENUM_LITERAL(index=2)
then 'cerr <<"Warning: " << <%msgVar%>;'
else
'throw ModelicaSimulationError(MODEL_EQ_SYSTEM,<%msgVar%>);'
%>

}
>>
Expand All @@ -11853,7 +11857,10 @@ template assertCommon(Exp condition, Exp message, Context context, Text &varDecl
{
<%preExpCond%>
<%preExpMsg%>
throw ModelicaSimulationError() << error_id(MODEL_EQ_SYSTEM);
<%match level case ENUM_LITERAL(index=2)
then 'cerr <<"Warning: >Assert in model equation";'
else 'throw ModelicaSimulationError() << error_id(MODEL_EQ_SYSTEM);'
%>
}
>>
%>
Expand Down Expand Up @@ -13468,7 +13475,7 @@ template algStmtAssert(DAE.Statement stmt, Context context, Text &varDecls,SimCo
::=
match stmt
case STMT_ASSERT(source=SOURCE(info=info)) then
assertCommon(cond, msg, context, &varDecls, info,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
assertCommon(cond, msg, level, context, &varDecls, info,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
end algStmtAssert;


Expand Down

0 comments on commit fb29737

Please sign in to comment.