Skip to content

Commit

Permalink
- move warnings for parameters from front end to back end
Browse files Browse the repository at this point in the history
- get rid of false warnings


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19097 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Feb 13, 2014
1 parent 26cc507 commit 4a9f69d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
9 changes: 4 additions & 5 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -1714,11 +1714,10 @@ algorithm
var = BackendVariable.setBindExp(var, SOME(startExp));
var = BackendVariable.setVarFixed(var, true);

// this is already covered in the front end
// s = ComponentReference.printComponentRefStr(cr);
// str = ExpressionDump.printExpStr(startExp);
// info = DAEUtil.getElementSourceFileInfo(BackendVariable.getVarSource(var));
// Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s, str}, info);
s = ComponentReference.printComponentRefStr(cr);
str = ExpressionDump.printExpStr(startExp);
info = DAEUtil.getElementSourceFileInfo(BackendVariable.getVarSource(var));
Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s, str}, info);

vars = BackendVariable.addVar(var, vars);
then ((var, (vars, fixvars, eqns, hs)));
Expand Down
11 changes: 6 additions & 5 deletions Compiler/FrontEnd/InstBinding.mo
Expand Up @@ -663,11 +663,12 @@ algorithm
(cache,binding) = makeBinding(cache,inEnv,inAttributes,startValueModification,inType,inPrefix,componentName,inInfo);
binding = DAEUtil.setBindingSource(binding, DAE.BINDING_FROM_START_VALUE());

s = componentName;
pre_str = PrefixUtil.printPrefixStr2(inPrefix);
s = pre_str +& s;
str = DAEUtil.printBindingExpStr(binding);
Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s,str}, inInfo);
// lochel: I moved the waring to the back end for now
// s = componentName;
// pre_str = PrefixUtil.printPrefixStr2(inPrefix);
// s = pre_str +& s;
// str = DAEUtil.printBindingExpStr(binding);
// Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s,str}, inInfo);
then
(cache,binding);

Expand Down
11 changes: 6 additions & 5 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -10681,14 +10681,15 @@ algorithm
(cache, DAE.CREF(cr,expTy), const, attr);

// adrpo: report a warning if the binding came from a start value!
// lochel: I moved the waring to the back end for now
case (cache,env,cr,attr as DAE.ATTR(variability = SCode.PARAM()),_,_,tt,bind as DAE.EQBOUND(source = DAE.BINDING_FROM_START_VALUE()),doVect,_,_,_,_)
equation
true = Types.getFixedVarAttributeParameterOrConstant(tt);
s = ComponentReference.printComponentRefStr(cr);
pre_str = PrefixUtil.printPrefixStr2(inPrefix);
s = pre_str +& s;
str = DAEUtil.printBindingExpStr(inBinding);
Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s,str}, info); // Don't add source info here... Many models give multiple errors that are not filtered out
// s = ComponentReference.printComponentRefStr(cr);
// pre_str = PrefixUtil.printPrefixStr2(inPrefix);
// s = pre_str +& s;
// str = DAEUtil.printBindingExpStr(inBinding);
// Error.addSourceMessage(Error.UNBOUND_PARAMETER_WITH_START_VALUE_WARNING, {s,str}, info); // Don't add source info here... Many models give multiple errors that are not filtered out
bind = DAEUtil.setBindingSource(bind, DAE.BINDING_FROM_DEFAULT_VALUE());
(cache, e_1, const, attr) = elabCref2(cache,env,cr,attr,constSubs,forIteratorConstOpt,tt,bind,doVect,splicedExpData,inPrefix,evalCref,info);
then
Expand Down

0 comments on commit 4a9f69d

Please sign in to comment.