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 <Python.h> to be the first include (before any system header that
pulls in features.h via <string>) 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.
This commit is contained in:
Martin Braun 2026-05-26 11:37:34 +02:00
parent 632f9927e5
commit 1b0c95e31a
2 changed files with 7 additions and 3 deletions

View File

@ -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&) {

View File

@ -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 <Python.h>
#include "mpmd_devices.hpp"
#include "mpmd_impl.hpp"
#include <uhd/device.hpp>
#include <uhd/utils/static.hpp>
#include <uhdlib/rfnoc/rfnoc_device.hpp>
// Need this import because pybind doesn't have an equivalent to Py_IsInitialized()
#include <Python.h>
#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <chrono>