Fixed warnings on Windows (#407)

Now builds clean on MSVC: cl version 19.51.36260 for x64, from Visual
Studio 2026 Build Tools 18.10.3.

Major items:

- [[maybe_unused]] instead of gcc/clang specific pragmas
- Removed names variables that weren't used
- Cast + explicit uing64
This commit is contained in:
Erik Fröjdh authored and GitHub committed 2026-10-06 14:49:24 +02:00
1 parent 7e1b8a765d
commit cdd8586f64
15 files changed
+47 -91

No files matched your search

+7 -11
View File
@@ -61,11 +61,6 @@ auto read_n_frames_from_RawSubFile(RawSubFile &self, size_t n_frames) {
return py::make_tuple(header, image);
}
// Disable warnings for unused parameters, as we ignore some
// in the __exit__ method
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
void define_raw_sub_file_io_bindings(py::module &m) {
py::class_<RawSubFile>(m, "RawSubFile")
.def(py::init<const std::filesystem::path &, DetectorType, size_t,
@@ -89,17 +84,18 @@ void define_raw_sub_file_io_bindings(py::module &m) {
})
.def("__enter__", [](RawSubFile &self) { return &self; })
.def("__exit__",
[](RawSubFile &self, const std::optional<pybind11::type> &exc_type,
const std::optional<pybind11::object> &exc_value,
const std::optional<pybind11::object> &traceback) {})
[]([[maybe_unused]] RawSubFile &self,
[[maybe_unused]] const std::optional<pybind11::type> &exc_type,
[[maybe_unused]] const std::optional<pybind11::object>
&exc_value,
[[maybe_unused]] const std::optional<pybind11::object>
&traceback) {})
.def("__iter__", [](RawSubFile &self) { return &self; })
.def("__next__", [](RawSubFile &self) {
try {
return read_frame_from_RawSubFile(self);
} catch (std::runtime_error &e) {
} catch (std::runtime_error &) {
throw py::stop_iteration();
}
});
}
#pragma GCC diagnostic pop