Skip to content

Commit

Permalink
- fix: template functionInitialResidual() a stronger test for no resi…
Browse files Browse the repository at this point in the history
…dual equations

  it could produce an empty array initialization when there is only an "initial algorithm" section 
  and no "initial equation" in the model (so that residualEquations is not empty {}, but it has no SES_RESIDUAL(__))
- fix: a copy/paste typo error in template literalExpConst() to properly count lengths of the unescaped strings

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15200 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
pavolpr committed Feb 17, 2013
1 parent c661013 commit 2967495
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1257,18 +1257,17 @@ template functionInitialResidual(list<SimEqSystem> residualEquations)
let body = (residualEquations |> eq2 =>
functionInitialResidualBody(eq2, &varDecls /*BUFD*/, &tmp)
;separator="\n")
let desc = match residualEquations
case {} then
<<
const char *initialResidualDescription[1] = {"empty"};
>>
else
let desc = if resDesc then
<<
const char *initialResidualDescription[] =
{
<%resDesc%>
};
>>
>>
else
<<
const char *initialResidualDescription[1] = {"empty"};
>>
<<
<%desc%>

Expand Down Expand Up @@ -8798,8 +8797,8 @@ template literalExpConst(Exp lit, Integer index) "These should all be declared s
else
<<
#define <%name%>_data "<%escstr%>"
static const size_t <%name%>_strlen = <%unescapedStringLength(string)%>;
static const char <%name%>[<%intAdd(1,unescapedStringLength(string))%>] = <%name%>_data;
static const size_t <%name%>_strlen = <%unescapedStringLength(escstr)%>;
static const char <%name%>[<%intAdd(1,unescapedStringLength(escstr))%>] = <%name%>_data;
>>
case lit as MATRIX(ty=ty as T_ARRAY(__))
case lit as ARRAY(ty=ty as T_ARRAY(__)) then
Expand Down

0 comments on commit 2967495

Please sign in to comment.