From 4b2c6cafaca98f03e1d12fbc3f33cf4a11e89973 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Tue, 9 Jun 2026 21:32:27 +0200 Subject: [PATCH] build: avoid -Wignored-attributes on the popen deleter - glibc declares pclose with function attributes (nothrow/leaf), so decltype(pclose)* carries attributes that gcc ignores on the unique_ptr template argument, emitting -Wignored-attributes - spell the deleter as a plain int(*)(FILE*) instead; pclose converts to it silently and the deleter behaves identically (both popen branches) --- fairmq/tools/Network.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fairmq/tools/Network.cxx b/fairmq/tools/Network.cxx index 7922f2c9..8d37d7a2 100644 --- a/fairmq/tools/Network.cxx +++ b/fairmq/tools/Network.cxx @@ -99,7 +99,7 @@ string getDefaultRouteNetworkInterface() string interfaceName; #ifdef __APPLE__ // MacOS - unique_ptr file( + unique_ptr file( popen("route -n get default | grep interface | cut -d \":\" -f 2", "r"), pclose); #else // Linux ifstream is("/proc/net/route"); @@ -128,7 +128,7 @@ string getDefaultRouteNetworkInterface() LOG(debug) << "could not get network interface of the default route from /proc/net/route, " "going to try via 'ip route'"; - unique_ptr file( + unique_ptr file( popen("ip route | grep default | cut -d \" \" -f 5 | head -n 1", "r"), pclose); #endif