Skip to content
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

[Refactor] Fix compiler warnings #3322

Merged
merged 2 commits into from
Oct 30, 2021
Merged

[Refactor] Fix compiler warnings #3322

merged 2 commits into from
Oct 30, 2021

Conversation

sjwsl
Copy link
Collaborator

@sjwsl sjwsl commented Oct 29, 2021

Related issue = #3287

Fix some of the compiler warnings in the C++ codebase.

  • Explicitly override
  • Explicitly hide methods from the base class
  • Use virtual destructors for base classes
  • Remove unused variables, functions and lambda captures
  • Avoid conversion from string literals to char*
  • Avoid reordering constructions of class members
  • All code paths return a value in non-void functions

@netlify
Copy link

netlify bot commented Oct 29, 2021

✔️ Deploy Preview for jovial-fermat-aa59dc canceled.

🔨 Explore the source changes: 1edb0ad

🔍 Inspect the deploy log: https://app.netlify.com/sites/jovial-fermat-aa59dc/deploys/617c14289796080008ff3a83

@sjwsl
Copy link
Collaborator Author

sjwsl commented Oct 29, 2021

/format

Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@@ -127,6 +127,8 @@ class GLCommandList : public CommandList {
struct Cmd {
virtual void execute() {
}
virtual ~Cmd() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the fix for the segfault in the release mode..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. These fixes are not related to that issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I think this kind of warning is way more serious than those like unused variables and really a dangerous sign in our codebase. Will it be better to treat some critical warnings like this as errors during CI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+100 on that. clang-tidy is able to catch this error (https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-virtual-class-destructor.html). Could you actually take some time looking into that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will open an issue for this. :)

@ailzhang ailzhang merged commit 628167a into taichi-dev:master Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants