From 1b0c95e31ab992144bb4f142970c413696c868c4 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 26 May 2026 11:37:34 +0200 Subject: [PATCH] lib: Fix compiler warnings with GCC 16 / Python 3.14 sim_find.cpp: Python 3.14's pyconfig.h redefines _POSIX_C_SOURCE and _XOPEN_SOURCE to older values, but only if they haven't been defined yet. Moving to be the first include (before any system header that pulls in features.h via ) prevents the -Wmacro-redefinition warnings that become errors under -Werror. usrprio_rpc_client.cpp: Value-initialize usrprio_device_info to silence -Wmaybe-uninitialized on the interface_num member, caught by GCC 16. --- host/lib/transport/nirio/rpc/usrprio_rpc_client.cpp | 2 +- host/lib/usrp/mpmd/sim_find.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/host/lib/transport/nirio/rpc/usrprio_rpc_client.cpp b/host/lib/transport/nirio/rpc/usrprio_rpc_client.cpp index 0267e3612..f05c2309d 100644 --- a/host/lib/transport/nirio/rpc/usrprio_rpc_client.cpp +++ b/host/lib/transport/nirio/rpc/usrprio_rpc_client.cpp @@ -53,7 +53,7 @@ nirio_status usrprio_rpc_client::niusrprio_enumerate(NIUSRPRIO_ENUMERATE_ARGS) if (nirio_status_not_fatal(status) && vtr_size > 0) { device_info_vtr.resize(vtr_size); for (size_t i = 0; i < (size_t)vtr_size; i++) { - usrprio_device_info info; + usrprio_device_info info{}; try { out_args >> info; } catch (std::exception&) { diff --git a/host/lib/usrp/mpmd/sim_find.cpp b/host/lib/usrp/mpmd/sim_find.cpp index d41d8dc10..1c2e2737f 100644 --- a/host/lib/usrp/mpmd/sim_find.cpp +++ b/host/lib/usrp/mpmd/sim_find.cpp @@ -4,13 +4,17 @@ // SPDX-License-Identifier: GPL-3.0-or-later // +// Python.h must be included before any system header that pulls in features.h, +// otherwise Python 3.14+ pyconfig.h will attempt to redefine _POSIX_C_SOURCE +// and _XOPEN_SOURCE after glibc has already set them to newer values. +// Need this import because pybind11 doesn't have an equivalent to Py_IsInitialized() +#include + #include "mpmd_devices.hpp" #include "mpmd_impl.hpp" #include #include #include -// Need this import because pybind doesn't have an equivalent to Py_IsInitialized() -#include #include #include #include