From 81588fba3b7575cdfa098d56c285127d0eace652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 6 May 2025 17:18:54 +0200 Subject: [PATCH] linking to threads and removed extra ; (#176) - Fixing broken build of tests on RH8 by linking pthreads - Removed extra ; causing warnings with -Wpedantic --- CMakeLists.txt | 4 ++++ src/JungfrauDataFile.cpp | 4 ++-- src/NumpyFile.cpp | 6 +++--- src/RawFile.cpp | 14 +++++++------- src/RawMasterFile.cpp | 4 ++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dc4555..fc51c14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -405,6 +405,9 @@ target_include_directories(aare_core PUBLIC "$" ) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + target_link_libraries( aare_core PUBLIC @@ -413,6 +416,7 @@ target_link_libraries( ${STD_FS_LIB} # from helpers.cmake PRIVATE aare_compiler_flags + Threads::Threads $ ) diff --git a/src/JungfrauDataFile.cpp b/src/JungfrauDataFile.cpp index 8f1f904..59a1a0a 100644 --- a/src/JungfrauDataFile.cpp +++ b/src/JungfrauDataFile.cpp @@ -89,7 +89,7 @@ void JungfrauDataFile::seek(size_t frame_index) { : frame_index; auto byte_offset = frame_offset * (m_bytes_per_frame + header_size); m_fp.seek(byte_offset); -}; +} size_t JungfrauDataFile::tell() { return m_current_frame_index; } size_t JungfrauDataFile::total_frames() const { return m_total_frames; } @@ -235,4 +235,4 @@ std::filesystem::path JungfrauDataFile::fpath(size_t file_index) const { return m_path / fname; } -} // namespace aare \ No newline at end of file +} // namespace aare diff --git a/src/NumpyFile.cpp b/src/NumpyFile.cpp index 109439a..e375ce3 100644 --- a/src/NumpyFile.cpp +++ b/src/NumpyFile.cpp @@ -72,8 +72,8 @@ void NumpyFile::get_frame_into(size_t frame_number, std::byte *image_buf) { } } -size_t NumpyFile::pixels_per_frame() { return m_pixels_per_frame; }; -size_t NumpyFile::bytes_per_frame() { return m_bytes_per_frame; }; +size_t NumpyFile::pixels_per_frame() { return m_pixels_per_frame; } +size_t NumpyFile::bytes_per_frame() { return m_bytes_per_frame; } std::vector NumpyFile::read_n(size_t n_frames) { // TODO: implement this in a more efficient way @@ -197,4 +197,4 @@ void NumpyFile::load_metadata() { m_header = {dtype, fortran_order, shape}; } -} // namespace aare \ No newline at end of file +} // namespace aare diff --git a/src/RawFile.cpp b/src/RawFile.cpp index 78cb6c5..c576453 100644 --- a/src/RawFile.cpp +++ b/src/RawFile.cpp @@ -34,7 +34,7 @@ RawFile::RawFile(const std::filesystem::path &fname, const std::string &mode) } } -Frame RawFile::read_frame() { return get_frame(m_current_frame++); }; +Frame RawFile::read_frame() { return get_frame(m_current_frame++); } Frame RawFile::read_frame(size_t frame_number) { seek(frame_number); @@ -52,13 +52,13 @@ void RawFile::read_into(std::byte *image_buf, size_t n_frames) { void RawFile::read_into(std::byte *image_buf) { return get_frame_into(m_current_frame++, image_buf); -}; +} void RawFile::read_into(std::byte *image_buf, DetectorHeader *header) { return get_frame_into(m_current_frame++, image_buf, header); -}; +} void RawFile::read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *header) { // return get_frame_into(m_current_frame++, image_buf, header); @@ -70,7 +70,7 @@ void RawFile::read_into(std::byte *image_buf, size_t n_frames, DetectorHeader *h header+=n_mod(); } -}; +} size_t RawFile::n_mod() const { return n_subfile_parts; } @@ -94,9 +94,9 @@ void RawFile::seek(size_t frame_index) { frame_index, total_frames())); } m_current_frame = frame_index; -}; +} -size_t RawFile::tell() { return m_current_frame; }; +size_t RawFile::tell() { return m_current_frame; } size_t RawFile::total_frames() const { return m_master.frames_in_file(); } size_t RawFile::rows() const { return m_geometry.pixels_y; } @@ -360,4 +360,4 @@ RawFile::~RawFile() { -} // namespace aare \ No newline at end of file +} // namespace aare diff --git a/src/RawMasterFile.cpp b/src/RawMasterFile.cpp index 052bb00..33807d4 100644 --- a/src/RawMasterFile.cpp +++ b/src/RawMasterFile.cpp @@ -87,7 +87,7 @@ int ScanParameters::start() const { return m_start; } int ScanParameters::stop() const { return m_stop; } void ScanParameters::increment_stop(){ m_stop += 1; -}; +} int ScanParameters::step() const { return m_step; } const std::string &ScanParameters::dac() const { return m_dac; } bool ScanParameters::enabled() const { return m_enabled; } @@ -417,4 +417,4 @@ void RawMasterFile::parse_raw(const std::filesystem::path &fpath) { if(m_frames_in_file==0) m_frames_in_file = m_total_frames_expected; } -} // namespace aare \ No newline at end of file +} // namespace aare