-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace printf with cout in JitCall tests #501
Draft
aaronj0
wants to merge
1
commit into
compiler-research:main
Choose a base branch
from
aaronj0:funccall-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -875,9 +875,14 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) { | |
|
||
GetAllTopLevelDecls(code, Decls); | ||
|
||
// Here we replace printf with cout for JitCall tests on Windows, where the stdout buffer is not flushed when we utilise JitCall::Invoke | ||
// This hints towards a larger underlying problem in the driver when going through cling: On windows, the `stdout` buffer is not flushed. With gtest, all the printf statements in functions invoked with `JitCall` like: | ||
// `void f2(std::string &s) { std::cout << s.c_str(); };` appear at the end of the test suite run. Attempting to fix this issue by force flushing does not work, and printf statements in the test code itself appear on the screen. This indicates issues with linking, since the Interpreter runtime operating on a different buffer than the compile runtime. We ideally want to support the usage of printf statements when invoked through `JitCall`. | ||
|
||
Comment on lines
+878
to
+881
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd open an issue with that text and mark disable these tests on windows. |
||
Interp->process(R"( | ||
#include <string> | ||
void f2(std::string &s) { printf("%s", s.c_str()); }; | ||
#include <iostream> | ||
void f2(std::string &s) { std::cout << s.c_str(); }; | ||
)"); | ||
|
||
Interp->process(R"( | ||
|
@@ -922,10 +927,11 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) { | |
|
||
// FIXME: Do we need to support private ctors? | ||
Interp->process(R"( | ||
#include <iostream> | ||
class C { | ||
public: | ||
C() { printf("Default Ctor Called\n"); } | ||
~C() { printf("Dtor Called\n"); } | ||
C() { std::cout << "Default Ctor Called\n"; } | ||
~C() { std::cout << "Dtor Called\n"; } | ||
}; | ||
)"); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcbarton, how could clang-format be happy with these lengthy lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vgvassilev You can adjust ColumnLimit (see https://stackoverflow.com/questions/47683910/can-you-set-clang-formats-line-length)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your asking why doesn't it complain, then its because for some reason the clang-format workflow isn't detecting the changed files (see https://github.com/compiler-research/CppInterOp/actions/runs/13305769758/job/37156307205?pr=501#step:5:25)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we exclude the folder from formatting... which is probably fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes your right. We don't technically disclude it, but only reference the include and lib folder in the clang-format command (see https://github.com/compiler-research/CppInterOp/blob/b797dbb4c8134349a1207d01b24dc3c4d93158de/.github/workflows/clang-format.yml#L44C1-L44C93). Maybe its something that was overlooked in the workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that was intentional.