Skip to content

Commit

Permalink
Merge pull request #1068 from lf-lang/trace-bug-fix-2
Browse files Browse the repository at this point in the history
Add LINGUA_FRANCA_TRACE to targetConfig to fix issue tracing.
  • Loading branch information
hokeun authored Apr 2, 2022
2 parents 7a7e3a5 + f01d9a5 commit 1cb92b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions org.lflang/src/org/lflang/generator/c/CPreambleGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static String generateDefineDirectives(
}
}
if (tracing != null) {
code.pr(generateTracingDefineDirective(tracing.traceFileName));
code.pr(generateTracingDefineDirective(targetConfig, tracing.traceFileName));
}
if (hasModalReactors) {
code.pr("#define MODAL_REACTORS");
Expand Down Expand Up @@ -108,10 +108,15 @@ private static String generateFederatedDefineDirective(CoordinationType coordina
return String.join("\n", directives);
}

private static String generateTracingDefineDirective(String traceFileName) {
private static String generateTracingDefineDirective(
TargetConfig targetConfig,
String traceFileName
) {
if (traceFileName == null) {
targetConfig.compileDefinitions.put("LINGUA_FRANCA_TRACE", "");
return "#define LINGUA_FRANCA_TRACE";
}
targetConfig.compileDefinitions.put("LINGUA_FRANCA_TRACE", traceFileName);
return "#define LINGUA_FRANCA_TRACE " + traceFileName;
}

Expand Down

0 comments on commit 1cb92b6

Please sign in to comment.