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

Commit 6c4fd46

Browse files
perostOpenModelica-Hudson
authored andcommitted
Added debug flag ignoreCycles for #4543.
- Added debug flag ignoreCycles to ignore the error regarding cyclically dependent constants or parameters.
1 parent 5bc9302 commit 6c4fd46

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Compiler/FrontEnd/InstUtil.mo

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,17 +1989,17 @@ protected function checkCyclicalComponents
19891989
input FCore.Graph inEnv;
19901990
type Element = tuple<SCode.Element, DAE.Mod>;
19911991
algorithm
1992-
_ := matchcontinue(inCycles, inEnv)
1992+
_ := matchcontinue inCycles
19931993
local
19941994
list<list<Element>> cycles;
19951995
list<list<String>> names;
19961996
list<String> cycles_strs;
19971997
String cycles_str, scope_str;
19981998
list<tuple<Element, list<Element>>> graph;
19991999

2000-
case ({}, _) then ();
2000+
case {} then ();
20012001

2002-
case (_, _)
2002+
case _
20032003
equation
20042004
graph = Graph.filterGraph(inCycles, isElementParamOrConst);
20052005
{} = Graph.findCycles(graph, isElementEqual);
@@ -2015,8 +2015,12 @@ algorithm
20152015
cycles_str = "{" + cycles_str + "}";
20162016
scope_str = FGraph.printGraphPathStr(inEnv);
20172017
Error.addMessage(Error.CIRCULAR_COMPONENTS, {scope_str, cycles_str});
2018+
2019+
if not Flags.isSet(Flags.IGNORE_CYCLES) then
2020+
fail();
2021+
end if;
20182022
then
2019-
fail();
2023+
();
20202024
end matchcontinue;
20212025
end checkCyclicalComponents;
20222026

Compiler/Util/Error.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public constant Message METARECORD_CONTAINS_METARECORD_MEMBER = MESSAGE(168, TRA
467467
public constant Message INVALID_EXTERNAL_OBJECT = MESSAGE(169, TRANSLATION(), ERROR(),
468468
Util.gettext("Invalid external object %s, %s."));
469469
public constant Message CIRCULAR_COMPONENTS = MESSAGE(170, TRANSLATION(), ERROR(),
470-
Util.gettext("Cyclically dependent constants or parameters found in scope %s: %s."));
470+
Util.gettext("Cyclically dependent constants or parameters found in scope %s: %s (ignore with -d=ignoreCycles)."));
471471
public constant Message FAILURE_TO_DEDUCE_DIMS_FROM_MOD = MESSAGE(171, TRANSLATION(), WARNING(),
472472
Util.gettext("Failed to deduce dimensions of %s due to unknown dimensions of modifier %s."));
473473
public constant Message REPLACEABLE_BASE_CLASS = MESSAGE(172, TRANSLATION(), ERROR(),

Compiler/Util/Flags.mo

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ constant DebugFlag MERGE_ALGORITHM_SECTIONS = DEBUG_FLAG(170, "mergeAlgSections"
516516
Util.gettext("Disables coloring algorithm while sparsity detection."));
517517
constant DebugFlag WARN_NO_NOMINAL = DEBUG_FLAG(171, "warnNoNominal", false,
518518
Util.gettext("Prints the iteration variables in the initialization and simulation DAE, which do not have a nominal value."));
519+
constant DebugFlag IGNORE_CYCLES = DEBUG_FLAG(172, "ignoreCycles", false,
520+
Util.gettext("Ignores cycles between constant/parameter components."));
519521

520522

521523
// This is a list of all debug flags, to keep track of which flags are used. A
@@ -694,7 +696,8 @@ constant list<DebugFlag> allDebugFlags = {
694696
NF_UNITCHECK,
695697
DISABLE_COLORING,
696698
MERGE_ALGORITHM_SECTIONS,
697-
WARN_NO_NOMINAL
699+
WARN_NO_NOMINAL,
700+
IGNORE_CYCLES
698701
};
699702

700703
public

0 commit comments

Comments
 (0)