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
@@ -21,11 +21,6 @@
namespace py = pybind11;
using namespace ::aare;
// 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_file_io_bindings(py::module &m) {
PYBIND11_NUMPY_DTYPE(DetectorHeader, frameNumber, expLength, packetNumber,
@@ -122,9 +117,12 @@ void define_file_io_bindings(py::module &m) {
})
.def("__enter__", [](File &self) { return &self; })
.def("__exit__",
[](File &self, const std::optional<pybind11::type> &exc_type,
const std::optional<pybind11::object> &exc_value,
const std::optional<pybind11::object> &traceback) {
[]([[maybe_unused]] File &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) {
// self.close();
})
.def("__iter__", [](File &self) { return &self; })
@@ -146,7 +144,7 @@ void define_file_io_bindings(py::module &m) {
self.read_into(
reinterpret_cast<std::byte *>(image.mutable_data()));
return image;
} catch (std::runtime_error &e) {
} catch (std::runtime_error &) {
throw py::stop_iteration();
}
});
@@ -160,6 +158,4 @@ void define_file_io_bindings(py::module &m) {
.def_property_readonly("start", &ScanParameters::start)
.def_property_readonly("stop", &ScanParameters::stop)
.def_property_readonly("step", &ScanParameters::step);
#pragma GCC diagnostic pop
}