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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/examples/basic_no_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#include <chrono>
#include <iostream>
#include <numeric>

#include <kvikio/batch.hpp>
#include <kvikio/buffer.hpp>
Expand Down
2 changes: 0 additions & 2 deletions cpp/include/kvikio/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#pragma once

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

#include <kvikio/defaults.hpp>
Expand Down
3 changes: 1 addition & 2 deletions cpp/include/kvikio/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#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.

#include <exception>
#include <system_error>
#include <stdexcept>

#include <kvikio/shim/cuda.hpp>
#include <kvikio/shim/cufile_h_wrapper.hpp>
Expand Down
2 changes: 0 additions & 2 deletions cpp/include/kvikio/parallel_operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include <cassert>
#include <future>
#include <numeric>
#include <system_error>
#include <utility>
#include <vector>

Expand Down
5 changes: 0 additions & 5 deletions cpp/src/remote_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

#include <sstream>
#include <stdexcept>
#include <string>

#include <kvikio/defaults.hpp>
#include <kvikio/error.hpp>
Expand Down