From abe0b7379a2aa0940c94436e80315bd99daa12b9 Mon Sep 17 00:00:00 2001 From: Tom Hensel Date: Wed, 29 Apr 2026 21:58:53 +0200 Subject: [PATCH 1/2] CMakeLists: bump CMAKE_CXX_STANDARD to 17 for UHD 4.10 UHD 4.10's (transitively included via ) uses C++17 type traits (std::is_floating_point_v, std::is_enum_v, std::is_same_v, std::enable_if_t with auto return type deduction). Building SoapyUHD as C++14 against UHD 4.10 fails with 'no member named to_str in namespace uhd::cast' because the SFINAE overloads can't be parsed. C++17 is the minimum required to consume UHD >= 4.10 headers. UHD 4.10 itself bumped to C++20 internally; consumers can stay on C++17. Signed-off-by: Tom Hensel --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 916687b..160f257 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ cmake_minimum_required(VERSION 2.8.12...3.10) project(SoapyUHD CXX C) enable_testing() -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) From 39be02bdef6a815d6b5c78b0384a0c3b15886432 Mon Sep 17 00:00:00 2001 From: Tom Hensel Date: Wed, 29 Apr 2026 22:22:54 +0200 Subject: [PATCH 2/2] Handle UHD 4.10 EVENT_CODE_OK and add 'override' on stream methods Two compiler-warning cleanups exposed by building against UHD 4.10 under -Wswitch / -Winconsistent-missing-override: 1. uhd::async_metadata_t::EVENT_CODE_OK was added in UHD 4.10 (commit that introduces the OK / non-error completion event). The readStreamStatus() switch in SoapyUHDDevice silently fell through for it and returned 0 -- functionally OK, but produced a 'enumeration value EVENT_CODE_OK not handled in switch' warning. Add an explicit case under '#if UHD_VERSION >= 4100000' that does the same thing (no flags set, no error). The version guard preserves compatibility with UHD 4.0..4.9 which don't have the enumerator yet. 2. UHDSoapyRxStream and UHDSoapyTxStream override eight virtuals from uhd::rx_streamer / uhd::tx_streamer (get_num_channels, get_max_num_samps, recv, issue_stream_cmd, send, recv_async_msg). Mark them with the 'override' keyword. This is harmless under pre-C++11 -- but at C++17/20 it gives the compiler the signal to diagnose accidental signature drift if UHD changes any base class prototype in a future minor release. Together these resolve the two remaining 'warning:' lines in the build output. Verified clean against uhd-oc 4.10.0.0 keg. Signed-off-by: Tom Hensel --- SoapyUHDDevice.cpp | 3 +++ UHDSoapyDevice.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/SoapyUHDDevice.cpp b/SoapyUHDDevice.cpp index 41140a8..305d3b2 100644 --- a/SoapyUHDDevice.cpp +++ b/SoapyUHDDevice.cpp @@ -361,6 +361,9 @@ class SoapyUHDDevice : public SoapySDR::Device switch (md.event_code) { +#if UHD_VERSION >= 4100000 + case uhd::async_metadata_t::EVENT_CODE_OK: break; +#endif case uhd::async_metadata_t::EVENT_CODE_BURST_ACK: flags |= SOAPY_SDR_END_BURST; break; case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW: return SOAPY_SDR_UNDERFLOW; case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR: return SOAPY_SDR_CORRUPTION; diff --git a/UHDSoapyDevice.cpp b/UHDSoapyDevice.cpp index 88641c5..074f225 100644 --- a/UHDSoapyDevice.cpp +++ b/UHDSoapyDevice.cpp @@ -568,12 +568,12 @@ class UHDSoapyRxStream : public uhd::rx_streamer _device->closeStream(_stream); } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return _nchan; } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _device->getStreamMTU(_stream); } @@ -584,7 +584,7 @@ class UHDSoapyRxStream : public uhd::rx_streamer uhd::rx_metadata_t &md, const double timeout = 0.1, const bool one_packet = false - ) + ) override { size_t total = 0; md.reset(); @@ -674,7 +674,7 @@ class UHDSoapyRxStream : public uhd::rx_streamer return total; } - void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd) + void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd) override { int flags = 0; if (not stream_cmd.stream_now) flags |= SOAPY_SDR_HAS_TIME; @@ -758,12 +758,12 @@ class UHDSoapyTxStream : public uhd::tx_streamer _device->closeStream(_stream); } - size_t get_num_channels(void) const + size_t get_num_channels(void) const override { return _nchan; } - size_t get_max_num_samps(void) const + size_t get_max_num_samps(void) const override { return _device->getStreamMTU(_stream); } @@ -773,7 +773,7 @@ class UHDSoapyTxStream : public uhd::tx_streamer size_t nsamps_per_buff, const uhd::tx_metadata_t &md, const double timeout = 0.1 - ) + ) override { //perform activation at the latest/on the first call to send if (not _active) @@ -808,7 +808,7 @@ class UHDSoapyTxStream : public uhd::tx_streamer return total; } - bool recv_async_msg(uhd::async_metadata_t &md, double timeout = 0.1) + bool recv_async_msg(uhd::async_metadata_t &md, double timeout = 0.1) override { size_t chanMask = 0; int flags = 0;