Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 45edd24

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Add a warning if FMU is generated without compile-time URI
Belonging to [master]: - OpenModelica/OpenModelica#127 - #3037
1 parent b694f3f commit 45edd24

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Compiler/SimCode/SimCodeUtil.mo

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13988,10 +13988,15 @@ function findResources
1398813988
input Mutable<Boolean> unknownUri;
1398913989
protected
1399013990
String f;
13991+
DAE.Exp e1;
1399113992
algorithm
1399213993
tree := match e
1399313994
case DAE.CALL(path=Absyn.IDENT("OpenModelica_fmuLoadResource"), expLst={DAE.SCONST(f)}) then AvlSetString.add(tree, f);
13994-
case DAE.CALL(path=Absyn.IDENT("OpenModelica_uriToFilename")) algorithm Mutable.update(unknownUri, true); then tree;
13995+
case DAE.CALL(path=Absyn.IDENT("OpenModelica_uriToFilename"), expLst=e1::_)
13996+
algorithm
13997+
Error.addMessage(Error.FMI_URI_RESOLVE, {ExpressionDump.printExpStr(e1)});
13998+
Mutable.update(unknownUri, true);
13999+
then tree;
1399514000
else tree;
1399614001
end match;
1399714002
end findResources;

Compiler/Util/Error.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,8 @@ public constant Message OCG_MISSING_BRANCH = MESSAGE(594, TRANSLATION(), WARNING
10141014
Util.gettext("Connections.rooted(%s) needs exactly one statement Connections.branch(%s, B.R) involving %s but we found none in the graph. Run with -d=cgraphGraphVizFile to debug"));
10151015
public constant Message UNBOUND_PARAMETER_EVALUATE_TRUE = MESSAGE(594, TRANSLATION(), WARNING(),
10161016
Util.gettext("Parameter %s has annotation(Evaluate=true) and no binding."));
1017+
public constant Message FMI_URI_RESOLVE = MESSAGE(595, TRANSLATION(), WARNING(),
1018+
Util.gettext("Could not resolve URI (%s) at compile-time; copying all loaded packages into the FMU"));
10171019

10181020
public constant Message MATCH_SHADOWING = MESSAGE(5001, TRANSLATION(), ERROR(),
10191021
Util.gettext("Local variable '%s' shadows another variable."));

0 commit comments

Comments
 (0)