From f48be9a602432e38065e11cd6812085c349142fc Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Fri, 30 Aug 2024 21:27:30 +0200 Subject: [PATCH] Fix warnings coming up with clang 17 Also with -Wunqualified-std-cast-call that's enabled on github's macos-14-arm64 runner. --- CMakeLists.txt | 2 +- pv/data/decode/decoder.cpp | 4 ---- pv/session.cpp | 2 +- pv/views/trace/analogsignal.cpp | 4 +++- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec86073d..b2cf2810 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -563,7 +563,7 @@ endif() add_definitions(-DQT_NO_KEYWORDS) add_definitions(-D__STDC_LIMIT_MACROS) -add_definitions(-Wall -Wextra) +add_definitions(-Wall -Wextra -Wunqualified-std-cast-call) add_definitions(${REQUIRED_STD_CXX_FLAGS}) add_definitions(-DBOOST_MATH_DISABLE_FLOAT128=1) diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index ebcbc1c9..8e2c9930 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -86,10 +86,6 @@ Decoder::Decoder(const srd_decoder *const dec, uint8_t stack_level) : } // Query the annotation rows and reference them by the classes that use them - uint32_t row_count = 0; - for (const GSList *rl = srd_decoder_->annotation_rows; rl; rl = rl->next) - row_count++; - i = 0; for (const GSList *rl = srd_decoder_->annotation_rows; rl; rl = rl->next) { const srd_decoder_annotation_row *const srd_row = (srd_decoder_annotation_row *)rl->data; diff --git a/pv/session.cpp b/pv/session.cpp index b4ecc6a8..03770097 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -607,7 +607,7 @@ void Session::set_device(shared_ptr device) signals_changed(); - device_ = move(device); + device_ = std::move(device); try { device_->open(); diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 2a50d571..853fd508 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -48,11 +48,13 @@ #include +using std::abs; using std::deque; using std::div; using std::div_t; // Note that "using std::isnan;" is _not_ put here since that would break // compilation on some platforms. Use "std::isnan()" instead in checks below. +using std::fabs; using std::max; using std::make_pair; using std::min; @@ -766,7 +768,7 @@ void AnalogSignal::process_next_sample_value(float x, float value) // Interpolate values to create values for the intermediate pixels const float start_value = prev_value_at_pixel_; const float end_value = value; - const int steps = fabs(pixel_pos - current_pixel_pos_); + const int steps = abs(pixel_pos - current_pixel_pos_); const double gradient = (end_value - start_value) / steps; for (int i = 0; i < steps; i++) { if (current_pixel_pos_ + i < 0)