From 2b63c2356c3597a8d3da728a24707e24ff8a06e8 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Fri, 12 Jul 2024 05:04:37 -0700 Subject: [PATCH 1/9] Adjust scope provider to resolve effects of whatdogs --- .../main/java/org/lflang/scoping/LFScopeProviderImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/org/lflang/scoping/LFScopeProviderImpl.java b/core/src/main/java/org/lflang/scoping/LFScopeProviderImpl.java index c5cbea4e7e..3455c1d822 100644 --- a/core/src/main/java/org/lflang/scoping/LFScopeProviderImpl.java +++ b/core/src/main/java/org/lflang/scoping/LFScopeProviderImpl.java @@ -49,6 +49,7 @@ import org.lflang.lf.Reactor; import org.lflang.lf.ReactorDecl; import org.lflang.lf.VarRef; +import org.lflang.lf.Watchdog; /** * This class enforces custom rules. In particular, it resolves references to parameters, ports, @@ -273,6 +274,11 @@ private RefType getRefType(VarRef variable) { } else if (conn.getRightPorts().contains(variable)) { return RefType.CRIGHT; } + } else if (variable.eContainer() instanceof Watchdog) { + var watchdog = (Watchdog) variable.eContainer(); + if (watchdog.getEffects().contains(variable)) { + return RefType.EFFECT; + } } return RefType.NULL; } From dce863cef383ccc9467cbb76fc20e5fbfd608df1 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 12 Jul 2024 09:54:29 -0400 Subject: [PATCH 2/9] Define action in watchdog handler when needed. --- .../generator/c/CWatchdogGenerator.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java index 9ce5dec07f..450ae54880 100644 --- a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java @@ -9,16 +9,12 @@ package org.lflang.generator.c; import java.util.List; + import org.lflang.MessageReporter; import org.lflang.ast.ASTUtils; import org.lflang.generator.CodeBuilder; import org.lflang.generator.ReactorInstance; -import org.lflang.lf.Mode; -import org.lflang.lf.ModeTransition; -import org.lflang.lf.Reactor; -import org.lflang.lf.VarRef; -import org.lflang.lf.Variable; -import org.lflang.lf.Watchdog; +import org.lflang.lf.*; import org.lflang.util.StringUtil; /** @@ -227,6 +223,8 @@ private static String generateInitializationForWatchdog( + name + " not a valid mode of this reactor."); } + } else if (variable instanceof Action) { + watchdogInitialization.pr(generateActionVariablesInHandler((Action)variable, tpr)); } } } @@ -243,6 +241,18 @@ private static String generateInitializationForWatchdog( return code.toString(); } + /** + * Generate action variables for the watchdog handler. + * @param action The action. + */ + private static String generateActionVariablesInHandler(Action action, TypeParameterizedReactor tpr) { + String structType = CGenerator.variableStructType(action, tpr, false); + CodeBuilder builder = new CodeBuilder(); + builder.pr("// Expose the action struct as a local variable whose name matches the action name."); + builder.pr(structType + "* " + action.getName() + " = &self->_lf_" + action.getName() + ";"); + return builder.toString(); + } + /** * Do heavy lifting to generate the watchdog handler function * @@ -268,6 +278,8 @@ private static String generateFunction( function.pr(header + " {"); function.indent(); function.pr(init); + function.pr("{"); // Limit scope. + function.indent(); function.pr("environment_t * __env = self->base.environment;"); function.pr("LF_MUTEX_LOCK(&__env->mutex);"); function.pr("tag_t tag = {.time =" + watchdog.getName() + "->expiration , .microstep=0};"); @@ -280,6 +292,8 @@ private static String generateFunction( function.pr("_lf_schedule_at_tag(__env, " + watchdog.getName() + "->trigger, tag, NULL);"); function.pr("lf_cond_broadcast(&__env->event_q_changed);"); function.pr("LF_MUTEX_UNLOCK(&__env->mutex);"); + function.unindent(); + function.pr("}"); function.prSourceLineNumber(watchdog.getCode(), suppressLineDirectives); function.pr(ASTUtils.toText(watchdog.getCode())); function.prEndSourceLineNumber(suppressLineDirectives); From 60ba58c22018b444e45040ef798e2a4e4af7ea14 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 12 Jul 2024 10:11:16 -0400 Subject: [PATCH 3/9] Added test for watchdog with action --- test/C/src/concurrent/WatchdogAction.lf | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 test/C/src/concurrent/WatchdogAction.lf diff --git a/test/C/src/concurrent/WatchdogAction.lf b/test/C/src/concurrent/WatchdogAction.lf new file mode 100644 index 0000000000..d5eb4fd68e --- /dev/null +++ b/test/C/src/concurrent/WatchdogAction.lf @@ -0,0 +1,74 @@ +/** + * Test watchdog. This test starts a watchdog timer of 1500ms every 1s. Half the time, it then + * sleeps after starting the watchdog so that the watchdog expires. There should be a total of two + * watchdog expirations. This version uses an action instead of a reaction to the watchdog. + * @author Benjamin Asch + * @author Edward A. Lee + */ +target C { + timeout: 11000 ms +} + +reactor Watcher(timeout: time = 1500 ms) { + // Offset ameliorates startup time. + timer t(1 s, 1 s) + // Period has to be smaller than watchdog timeout. Produced if the watchdog triggers. + output d: int + state count: int = 0 + logical action a + + watchdog poodle(timeout) -> a {= + instant_t p = lf_time_physical_elapsed(); + lf_print("******** Watchdog timed out at elapsed physical time: " PRINTF_TIME, p); + self->count++; + lf_schedule(a, 0); + =} + + reaction(t) -> poodle, d {= + lf_watchdog_start(poodle, 0); + lf_print("Watchdog started at physical time " PRINTF_TIME, lf_time_physical_elapsed()); + lf_print("Will expire at " PRINTF_TIME, lf_time_logical_elapsed() + self->timeout); + lf_set(d, 42); + =} + + reaction(a) -> d {= + lf_print("Reaction poodle was called."); + lf_set(d, 1); + =} + + reaction(shutdown) -> poodle {= + lf_watchdog_stop(poodle); + // Watchdog may expire in tests even without the sleep, but it should at least expire twice. + if (self->count < 2) { + lf_print_error_and_exit("Watchdog expired %d times. Expected at least 2.", self->count); + } + =} +} + +main reactor { + logical action a + state count: int = 0 + + w = new Watcher() + + reaction(startup) {= + if (NUMBER_OF_WATCHDOGS != 1) { + lf_print_error_and_exit("NUMBER_OF_WATCHDOGS was %d", NUMBER_OF_WATCHDOGS); + } + =} + + reaction(w.d) {= + lf_print("Watcher reactor produced an output. %d", self->count % 2); + self->count++; + if (self->count % 4 == 0) { + lf_print(">>>>>> Taking a long time to process that output!"); + lf_sleep(MSEC(1600)); + } + =} + + reaction(shutdown) {= + if (self->count < 12) { + lf_print_error_and_exit("Watchdog produced output %d times. Expected at least 12.", self->count); + } + =} +} From 14c2e42265996ef9aebc19ff070984b9d5955908 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 12 Jul 2024 16:45:33 -0400 Subject: [PATCH 4/9] Support watchdog handler driving action in diagrams --- .../synthesis/LinguaFrancaSynthesis.java | 64 +++++++++++-------- .../diagram/synthesis/util/ReactorIcons.java | 2 +- .../lflang/generator/WatchdogInstance.java | 22 ++++++- 3 files changed, 58 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 7d8dfb1c10..9e4facbfc7 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -1215,6 +1215,42 @@ private Collection transformReactorNetwork( } } + // Connect watchdogs + Set watchdogs = new HashSet<>(); + watchdogs.addAll(watchdogSources.keySet()); + watchdogs.addAll(watchdogDestinations.keySet()); + + for (WatchdogInstance watchdog : watchdogs) { + KNode node = associateWith(_kNodeExtensions.createNode(), watchdog.getDefinition()); + NamedInstanceUtil.linkInstance(node, watchdog); + _utilityExtensions.setID(node, watchdog.uniqueID()); + nodes.add(node); + setLayoutOption(node, CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); + Pair ports = _linguaFrancaShapeExtensions.addWatchdogFigureAndPorts(node); + setAnnotatedLayoutOptions(watchdog.getDefinition(), node); + if (watchdog.getTimeout() != null) { + _kLabelExtensions.addOutsideBottomCenteredNodeLabel( + node, String.format("timeout: %s", watchdog.getTimeout().toString()), 7); + } + Set> iterSet = + watchdog.effects != null ? watchdog.effects : new HashSet<>(); + for (TriggerInstance effect : iterSet) { + if (effect instanceof ActionInstance) { + actionSources.put((ActionInstance) effect, ports.getValue()); + } + } + + // connect source + for (KPort source : watchdogSources.get(watchdog)) { + connect(createDelayEdge(watchdog), source, ports.getKey()); + } + + // connect targets + for (KPort target : watchdogDestinations.get(watchdog)) { + connect(createDelayEdge(watchdog), ports.getValue(), target); + } + } + // Connect actions Set actions = new HashSet<>(); actions.addAll(actionSources.keySet()); @@ -1258,34 +1294,6 @@ private Collection transformReactorNetwork( } } - // Connect watchdogs - Set watchdogs = new HashSet<>(); - watchdogs.addAll(watchdogSources.keySet()); - watchdogs.addAll(watchdogDestinations.keySet()); - - for (WatchdogInstance watchdog : watchdogs) { - KNode node = associateWith(_kNodeExtensions.createNode(), watchdog.getDefinition()); - NamedInstanceUtil.linkInstance(node, watchdog); - _utilityExtensions.setID(node, watchdog.uniqueID()); - nodes.add(node); - setLayoutOption(node, CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); - Pair ports = _linguaFrancaShapeExtensions.addWatchdogFigureAndPorts(node); - setAnnotatedLayoutOptions(watchdog.getDefinition(), node); - if (watchdog.getTimeout() != null) { - _kLabelExtensions.addOutsideBottomCenteredNodeLabel( - node, String.format("timeout: %s", watchdog.getTimeout().toString()), 7); - } - // connect source - for (KPort source : watchdogSources.get(watchdog)) { - connect(createDelayEdge(watchdog), source, ports.getKey()); - } - - // connect targets - for (KPort target : watchdogDestinations.get(watchdog)) { - connect(createDelayEdge(watchdog), ports.getValue(), target); - } - } - // Transform connections. // First, collect all the source ports. List sourcePorts = new LinkedList<>(reactorInstance.inputs); diff --git a/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java b/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java index a69b7d3e4f..8c07d9604f 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java @@ -106,7 +106,7 @@ public void handleIcon(KContainerRendering rendering, ReactorDecl reactor, boole // if (error != null) { // var errorText = _kContainerRenderingExtensions.addText(rendering, // "Icon not found!\n"+error); - // _kRenderingExtensions.setForeground(errorText, Colors.RED); + // _kRenderingExtensions.setForeground(errorText, Colors.BLUE); // _kRenderingExtensions.setFontBold(errorText, true); // _kRenderingExtensions.setSurroundingSpaceGrid(errorText, 8, 0); // } diff --git a/core/src/main/java/org/lflang/generator/WatchdogInstance.java b/core/src/main/java/org/lflang/generator/WatchdogInstance.java index 2abc7c166f..57ad4454f3 100644 --- a/core/src/main/java/org/lflang/generator/WatchdogInstance.java +++ b/core/src/main/java/org/lflang/generator/WatchdogInstance.java @@ -9,7 +9,10 @@ package org.lflang.generator; import org.lflang.TimeValue; -import org.lflang.lf.Watchdog; +import org.lflang.lf.*; + +import java.util.LinkedHashSet; +import java.util.Set; /** * Instance of a watchdog. Upon creation the actual delay is converted into a proper time value. If @@ -33,6 +36,17 @@ public WatchdogInstance(Watchdog definition, ReactorInstance reactor) { this.name = definition.getName().toString(); this.definition = definition; this.reactor = reactor; + for (VarRef effect : definition.getEffects()) { + Variable variable = effect.getVariable(); + if (variable instanceof Action) { + // Effect is an Action. + var actionInstance = reactor.lookupActionInstance((Action) variable); + if (actionInstance != null) this.effects.add(actionInstance); + } else { + // Effect is either a mode or an unresolved reference. + // Do nothing, transitions will be set up by the ModeInstance. + } + } } ////////////////////////////////////////////////////// @@ -59,6 +73,12 @@ public String toString() { return "WatchdogInstance " + name + "(" + timeout.toString() + ")"; } + ////////////////////////////////////////////////////// + //// Public fields. + + /** The ports or actions that this reaction may write to. */ + public Set> effects = new LinkedHashSet<>(); + ////////////////////////////////////////////////////// //// Private fields. From e3d689b0de7b3951038af4a658c5381534e48309 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sat, 13 Jul 2024 03:41:28 -0700 Subject: [PATCH 5/9] Addressed various linter complaints --- .../lflang/generator/WatchdogInstance.java | 18 +++--- .../generator/c/CWatchdogGenerator.java | 55 +++++++++---------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/WatchdogInstance.java b/core/src/main/java/org/lflang/generator/WatchdogInstance.java index 57ad4454f3..73abe02b75 100644 --- a/core/src/main/java/org/lflang/generator/WatchdogInstance.java +++ b/core/src/main/java/org/lflang/generator/WatchdogInstance.java @@ -8,17 +8,19 @@ */ package org.lflang.generator; -import org.lflang.TimeValue; -import org.lflang.lf.*; - import java.util.LinkedHashSet; import java.util.Set; +import org.lflang.TimeValue; +import org.lflang.lf.Action; +import org.lflang.lf.VarRef; +import org.lflang.lf.Variable; +import org.lflang.lf.Watchdog; /** * Instance of a watchdog. Upon creation the actual delay is converted into a proper time value. If * a parameter is referenced, it is looked up in the given (grand)parent reactor instance. * - * @author{Benjamin Asch } + * @author Benjamin Asch */ public class WatchdogInstance extends TriggerInstance { @@ -33,7 +35,7 @@ public WatchdogInstance(Watchdog definition, ReactorInstance reactor) { this.timeout = TimeValue.ZERO; } - this.name = definition.getName().toString(); + this.name = definition.getName(); this.definition = definition; this.reactor = reactor; for (VarRef effect : definition.getEffects()) { @@ -42,10 +44,8 @@ public WatchdogInstance(Watchdog definition, ReactorInstance reactor) { // Effect is an Action. var actionInstance = reactor.lookupActionInstance((Action) variable); if (actionInstance != null) this.effects.add(actionInstance); - } else { - // Effect is either a mode or an unresolved reference. - // Do nothing, transitions will be set up by the ModeInstance. } + // Otherwise, do nothing (effect is either a mode or an unresolved reference). } } @@ -61,7 +61,7 @@ public Watchdog getDefinition() { } public TimeValue getTimeout() { - return (TimeValue) this.timeout; + return this.timeout; } public ReactorInstance getReactor() { diff --git a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java index 450ae54880..ce434bc0dd 100644 --- a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java @@ -9,18 +9,24 @@ package org.lflang.generator.c; import java.util.List; - import org.lflang.MessageReporter; import org.lflang.ast.ASTUtils; import org.lflang.generator.CodeBuilder; import org.lflang.generator.ReactorInstance; -import org.lflang.lf.*; +import org.lflang.lf.Action; +import org.lflang.lf.Mode; +import org.lflang.lf.ModeTransition; +import org.lflang.lf.Reactor; +import org.lflang.lf.VarRef; +import org.lflang.lf.Variable; +import org.lflang.lf.Watchdog; import org.lflang.util.StringUtil; /** - * @brief Generate C code for watchdogs. This class contains a collection of static methods - * supporting code generation in C for watchdogs. These methods are protected because they are - * intended to be used only within the same package. + * Generate C code for watchdogs. This class contains a collection of static methods supporting code + * generation in C for watchdogs. These methods are protected because they are intended to be used + * only within the same package. + * * @author Benjamin Asch * @author Edward A. Lee */ @@ -34,8 +40,7 @@ public class CWatchdogGenerator { */ public static boolean hasWatchdogs(Reactor reactor) { List watchdogs = ASTUtils.allWatchdogs(reactor); - if (watchdogs != null && !watchdogs.isEmpty()) return true; - return false; + return !watchdogs.isEmpty(); } ///////////////////////////////////////////////////////////////// @@ -155,15 +160,6 @@ protected static void generateWatchdogStruct( } } - /** - * Generate a global table of watchdog structs. - * - * @param count The number of watchdogs found. - * @return The code that defines the table or a comment if count is 0. - */ - ///////////////////////////////////////////////////////////////// - // Private methods - /** * Generate necessary initialization code inside the body of a watchdog handler. * @@ -181,17 +177,13 @@ private static String generateInitializationForWatchdog( // Define the "self" struct. String structType = CUtil.selfType(tpr); - // A null structType means there are no inputs, state, - // or anything else. No need to declare it. - if (structType != null) { - code.pr( - String.join( - "\n", - structType - + "* self = (" - + structType - + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);")); - } + code.pr( + String.join( + "\n", + structType + + "* self = (" + + structType + + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);")); // Declare mode if in effects field of watchdog if (watchdog.getEffects() != null) { @@ -224,7 +216,7 @@ private static String generateInitializationForWatchdog( + " not a valid mode of this reactor."); } } else if (variable instanceof Action) { - watchdogInitialization.pr(generateActionVariablesInHandler((Action)variable, tpr)); + watchdogInitialization.pr(generateActionVariablesInHandler((Action) variable, tpr)); } } } @@ -243,12 +235,15 @@ private static String generateInitializationForWatchdog( /** * Generate action variables for the watchdog handler. + * * @param action The action. */ - private static String generateActionVariablesInHandler(Action action, TypeParameterizedReactor tpr) { + private static String generateActionVariablesInHandler( + Action action, TypeParameterizedReactor tpr) { String structType = CGenerator.variableStructType(action, tpr, false); CodeBuilder builder = new CodeBuilder(); - builder.pr("// Expose the action struct as a local variable whose name matches the action name."); + builder.pr( + "// Expose the action struct as a local variable whose name matches the action name."); builder.pr(structType + "* " + action.getName() + " = &self->_lf_" + action.getName() + ";"); return builder.toString(); } From 427739a5031819a7c93d42ad6d0e44915bfd1381 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 13 Jul 2024 07:39:34 -0400 Subject: [PATCH 6/9] Reversed accidental change --- .../java/org/lflang/diagram/synthesis/util/ReactorIcons.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java b/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java index 8c07d9604f..a69b7d3e4f 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/util/ReactorIcons.java @@ -106,7 +106,7 @@ public void handleIcon(KContainerRendering rendering, ReactorDecl reactor, boole // if (error != null) { // var errorText = _kContainerRenderingExtensions.addText(rendering, // "Icon not found!\n"+error); - // _kRenderingExtensions.setForeground(errorText, Colors.BLUE); + // _kRenderingExtensions.setForeground(errorText, Colors.RED); // _kRenderingExtensions.setFontBold(errorText, true); // _kRenderingExtensions.setSurroundingSpaceGrid(errorText, 8, 0); // } From 8d3d936ca7133f15ec013337607b87ebe8cb1bcb Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 13 Jul 2024 07:44:30 -0400 Subject: [PATCH 7/9] Comments only --- test/C/src/concurrent/Watchdog.lf | 2 +- test/C/src/concurrent/WatchdogAction.lf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/C/src/concurrent/Watchdog.lf b/test/C/src/concurrent/Watchdog.lf index 45903401a3..ba0eb06843 100644 --- a/test/C/src/concurrent/Watchdog.lf +++ b/test/C/src/concurrent/Watchdog.lf @@ -10,7 +10,7 @@ target C { } reactor Watcher(timeout: time = 1500 ms) { - // Offset ameliorates startup time. + // Offset may reduce the likelihood of flakiness if long startup times occur. timer t(1 s, 1 s) // Period has to be smaller than watchdog timeout. Produced if the watchdog triggers. output d: int diff --git a/test/C/src/concurrent/WatchdogAction.lf b/test/C/src/concurrent/WatchdogAction.lf index d5eb4fd68e..2ca5157142 100644 --- a/test/C/src/concurrent/WatchdogAction.lf +++ b/test/C/src/concurrent/WatchdogAction.lf @@ -10,7 +10,7 @@ target C { } reactor Watcher(timeout: time = 1500 ms) { - // Offset ameliorates startup time. + // Offset may reduce the likelihood of flakiness if long startup times occur. timer t(1 s, 1 s) // Period has to be smaller than watchdog timeout. Produced if the watchdog triggers. output d: int From bb50d7d8e51224f7925bf565bd4ef80b1c5e3e98 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 13 Jul 2024 08:43:03 -0400 Subject: [PATCH 8/9] Removed spurious String.join --- .../org/lflang/generator/c/CWatchdogGenerator.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java index ce434bc0dd..5c420d91e4 100644 --- a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java @@ -177,13 +177,10 @@ private static String generateInitializationForWatchdog( // Define the "self" struct. String structType = CUtil.selfType(tpr); - code.pr( - String.join( - "\n", - structType - + "* self = (" - + structType - + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);")); + code.pr(structType + + "* self = (" + + structType + + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);"); // Declare mode if in effects field of watchdog if (watchdog.getEffects() != null) { From a19589a2ddf61cf4dfb6868fc10a74b3003574d1 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 13 Jul 2024 09:12:44 -0400 Subject: [PATCH 9/9] Spotless --- .../java/org/lflang/generator/c/CWatchdogGenerator.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java index 5c420d91e4..e83ea122af 100644 --- a/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CWatchdogGenerator.java @@ -177,10 +177,8 @@ private static String generateInitializationForWatchdog( // Define the "self" struct. String structType = CUtil.selfType(tpr); - code.pr(structType - + "* self = (" - + structType - + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);"); + code.pr( + structType + "* self = (" + structType + "*)instance_args; SUPPRESS_UNUSED_WARNING(self);"); // Declare mode if in effects field of watchdog if (watchdog.getEffects() != null) {