Skip to content

Build cleanly against UHD 4.10#70

Open
gretel wants to merge 2 commits into
pothosware:masterfrom
gretel:pr/uhd-4.10-build
Open

Build cleanly against UHD 4.10#70
gretel wants to merge 2 commits into
pothosware:masterfrom
gretel:pr/uhd-4.10-build

Conversation

@gretel
Copy link
Copy Markdown

@gretel gretel commented May 1, 2026

Build cleanly against UHD 4.10

Changed

  • Bump CMAKE_CXX_STANDARD from 14 to 17.
  • Handle EVENT_CODE_OK in the async-metadata switch.
  • Add override specifier to virtual stream methods.

Why

UHD 4.10 public headers (e.g. uhd::cast::to_str in assert_has.ipp) require C++17 (std::optional, std::is_same_v). EVENT_CODE_OK is new in 4.10 and triggers -Wswitch. override silences -Winconsistent-missing-override.

gretel added 2 commits May 1, 2026 22:15
UHD 4.10's <uhd/utils/cast.hpp> (transitively included via
<uhd/usrp/multi_usrp.hpp>) 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 <code@jitter.eu>
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 <code@jitter.eu>
@gretel gretel marked this pull request as ready for review May 1, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant