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

Remove unused headers #544

Draft
wants to merge 2 commits into
base: branch-24.12
Choose a base branch
from

Conversation

kingcrimsontianyu
Copy link
Contributor

This PR removes unused headers.

@kingcrimsontianyu kingcrimsontianyu self-assigned this Nov 7, 2024
@kingcrimsontianyu kingcrimsontianyu added improvement Improves an existing functionality non-breaking Introduces a non-breaking change c++ Affects the C++ API of KvikIO labels Nov 7, 2024
@kingcrimsontianyu kingcrimsontianyu marked this pull request as ready for review November 7, 2024 19:48
@kingcrimsontianyu kingcrimsontianyu requested a review from a team as a code owner November 7, 2024 19:48
@@ -16,8 +16,6 @@
#pragma once

#include <cstring>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need <stdexcept> for std::runtime_error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Done.

@@ -17,11 +17,6 @@
#include <cassert>
#include <cstddef>
#include <cstring>
#include <iostream>
#include <memory>
Copy link
Contributor

Choose a reason for hiding this comment

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

<memory> is needed for std::unique_ptr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The header file remote_handle.hpp has already included <memory> for the unique pointers used in the header.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, we should include all used headers, regardless of redundancy with what the included headers include themselves.

Copy link
Contributor Author

@kingcrimsontianyu kingcrimsontianyu Nov 8, 2024

Choose a reason for hiding this comment

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

The headers I removed were reported by the clangd plug-in that comes with the dev container. The plug-in uses the "include cleaner" to identify the unused include. Given that transitive include is discouraged, and that we do not have misc-include-cleaner in the .clang-tidy file, I'll revert the changes.
Edit: I'm still seeing some of the warnings clangd makes.

Copy link
Contributor

@bdice bdice Nov 8, 2024

Choose a reason for hiding this comment

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

Yes, we aim to avoid relying on transitive header inclusions. If an identifier is used in a file, the corresponding header should be included.

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, I am happy to accept partial fixes that improve the state of things. For cleanups like this, it is easy to let work drag on. I prefer to accept improvements as-is even if they don’t fix every instance of a problem. Then future diffs can be smaller and we avoid generating conflicts along the way.

@kingcrimsontianyu
Copy link
Contributor Author

Running clang-tidy with misc-include-cleaner on, it turns out quite a number of places rely on transitive include. Further changes would be necessary to fully follow the best practices.

@kingcrimsontianyu kingcrimsontianyu marked this pull request as draft November 8, 2024 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Affects the C++ API of KvikIO improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants