From d86cb533c8d279c63f82f8c929fcda8549de10b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 11 Feb 2025 11:48:01 +0100 Subject: [PATCH] Fix minor warnings (#126) - Unused variables - signed vs. unsigned - added -flto=auto --- CMakeLists.txt | 1 + include/aare/ClusterVector.hpp | 1 - python/src/cluster.hpp | 2 +- python/src/file.hpp | 7 ++++++- src/decode.cpp | 4 ++-- src/geo_helpers.cpp | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 165c435..6cab73a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,6 +244,7 @@ target_compile_options( -Wvla -Wdouble-promotion -Werror=return-type #important can cause segfault in optimzed builds + -flto=auto ) endif() #GCC/Clang specific diff --git a/include/aare/ClusterVector.hpp b/include/aare/ClusterVector.hpp index 73257ce..febf06c 100644 --- a/include/aare/ClusterVector.hpp +++ b/include/aare/ClusterVector.hpp @@ -163,7 +163,6 @@ template class ClusterVector { throw std::runtime_error( "Only 3x3 clusters are supported for the 2x2 sum."); } - const size_t n_pixels = m_cluster_size_x * m_cluster_size_y; std::byte *ptr = m_data + 2 * sizeof(CoordType); // skip x and y for (size_t i = 0; i < m_size; i++) { diff --git a/python/src/cluster.hpp b/python/src/cluster.hpp index 0e7aac9..792b7e6 100644 --- a/python/src/cluster.hpp +++ b/python/src/cluster.hpp @@ -153,7 +153,7 @@ void define_cluster_finder_bindings(py::module &m) { [](ClusterFinder &self, py::array_t frame, uint64_t frame_number) { auto view = make_view_2d(frame); - self.find_clusters(view); + self.find_clusters(view, frame_number); return; }, py::arg(), py::arg("frame_number") = 0); diff --git a/python/src/file.hpp b/python/src/file.hpp index f20e0ce..c3c800c 100644 --- a/python/src/file.hpp +++ b/python/src/file.hpp @@ -20,6 +20,11 @@ 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) { @@ -238,7 +243,7 @@ void define_file_io_bindings(py::module &m) { return image; }); - +#pragma GCC diagnostic pop // py::class_(m, "ClusterHeader") // .def(py::init<>()) // .def_readwrite("frame_number", &ClusterHeader::frame_number) diff --git a/src/decode.cpp b/src/decode.cpp index a525faa..8af8319 100644 --- a/src/decode.cpp +++ b/src/decode.cpp @@ -22,8 +22,8 @@ uint16_t adc_sar_05_decode64to16(uint64_t input){ } void adc_sar_05_decode64to16(NDView input, NDView output){ - for(size_t i = 0; i < input.shape(0); i++){ - for(size_t j = 0; j < input.shape(1); j++){ + for(int64_t i = 0; i < input.shape(0); i++){ + for(int64_t j = 0; j < input.shape(1); j++){ output(i,j) = adc_sar_05_decode64to16(input(i,j)); } } diff --git a/src/geo_helpers.cpp b/src/geo_helpers.cpp index e823f22..39086ec 100644 --- a/src/geo_helpers.cpp +++ b/src/geo_helpers.cpp @@ -13,9 +13,9 @@ DetectorGeometry update_geometry_with_roi(DetectorGeometry geo, aare::ROI roi) { #endif int pos_y = 0; int pos_y_increment = 0; - for (size_t row = 0; row < geo.modules_y; row++) { + for (int row = 0; row < geo.modules_y; row++) { int pos_x = 0; - for (size_t col = 0; col < geo.modules_x; col++) { + for (int col = 0; col < geo.modules_x; col++) { auto &m = geo.module_pixel_0[row * geo.modules_x + col]; auto original_height = m.height; auto original_width = m.width;