Skip to content

Commit

Permalink
Fix warnings coming up with clang 17
Browse files Browse the repository at this point in the history
Also with -Wunqualified-std-cast-call that's enabled on github's macos-14-arm64 runner.
  • Loading branch information
abraxa committed Aug 30, 2024
1 parent 3cb3859 commit f48be9a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@swegener

swegener Aug 31, 2024

-Wunqualified-std-cast-call is only supported by clang, resulting in gcc failing to build pulseview:

x86_64-pc-linux-gnu-g++-13: error: unrecognized command-line option ‘-Wunqualified-std-cast-call’

This comment has been minimized.

Copy link
@abraxa

abraxa Aug 31, 2024

Author Member

Thanks, that was a mistake, I intended to only use that for local testing. Removed now.

This comment has been minimized.

Copy link
@swegener

swegener Aug 31, 2024

That was fast, thanks! Was about to prepare a pull request with:

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions(-Wunqualified-std-cast-call)
endif()

to make it conditional to clang.

add_definitions(${REQUIRED_STD_CXX_FLAGS})

add_definitions(-DBOOST_MATH_DISABLE_FLOAT128=1)
Expand Down
4 changes: 0 additions & 4 deletions pv/data/decode/decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pv/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void Session::set_device(shared_ptr<devices::Device> device)

signals_changed();

device_ = move(device);
device_ = std::move(device);

try {
device_->open();
Expand Down
4 changes: 3 additions & 1 deletion pv/views/trace/analogsignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@

#include <libsigrokcxx/libsigrokcxx.hpp>

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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f48be9a

Please sign in to comment.