-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2201 from lf-lang/fix-clang-warnings
Fixed clang warnings in generated C++ code
- Loading branch information
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
test/Cpp/src/multiport/MultiportToMultiportAfterParameterized.lf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Test multiport to multiport connections. See also MultiportToMultiport. | ||
target Cpp | ||
|
||
reactor Source(width: size_t = 2) { | ||
output[width] out: size_t | ||
|
||
reaction(startup) -> out {= | ||
for (size_t i = 0; i < out.size(); i++) { | ||
out[i].set(i); | ||
} | ||
=} | ||
} | ||
|
||
reactor Destination(width: size_t = 2) { | ||
input[width] in: size_t | ||
|
||
reaction(in) {= | ||
for (size_t i = 0; i < in.size(); i++) { | ||
if (in[i].is_present()) { | ||
size_t value = *in[i].get(); | ||
std::cout << "Received on channel " << i << ": " << value << '\n'; | ||
// NOTE: For testing purposes, this assumes the specific | ||
// widths instantiated below. | ||
if (value != i % 3) { | ||
std::cerr << "ERROR: expected " << i % 3 << '\n'; | ||
exit(1); | ||
} | ||
} | ||
} | ||
if (get_elapsed_logical_time() != 1s) { | ||
std::cerr << "ERROR: Expected to receive input after one second.\n"; | ||
exit(2); | ||
} | ||
=} | ||
} | ||
|
||
main reactor(delay: time = 1 sec) { | ||
a1 = new Source(width=3) | ||
a2 = new Source(width=2) | ||
b = new Destination(width=5) | ||
a1.out, a2.out -> b.in after delay | ||
} |