]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[slirp] Disable warnings for uncleanly deprecated libslirp functions
authorMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2026 15:45:28 +0000 (15:45 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2026 15:47:32 +0000 (15:47 +0000)
libslirp introduced a new API for constructing polling lists, to
accommodate Windows platforms where a handle descriptor may be too
large for an int.

Older versions of libslirp do not have the new API calls, and the
older API calls were immediately marked as deprecated, with no
overlap.  We would therefore need to use #ifdef and always have some
code that is deliberately not compiled, depending on the version of
libslirp that we find on the user's system.  This is highly
undesirable.

Work around this by disabling the deprecation warning (which is what
libslirp itself does for the portions of its code that necessarily
touch the deprecated functions).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/linux/linux_api.c

index 459e39fd5e865a75cd7d6bd9bf137f010712be41..349efe3c24890811a1c9a084f8545e4d7bf92632 100644 (file)
@@ -381,6 +381,28 @@ const char * __asmcall linux_strerror ( int linux_errno ) {
 
 #ifdef HAVE_LIBSLIRP
 
+/* Allow use of fd-based polling mechanism
+ *
+ * libslirp introduced a new API for constructing polling lists, to
+ * accommodate Windows platforms where a handle descriptor may be too
+ * large for an int.
+ *
+ * Older versions of libslirp do not have the new API calls, and the
+ * older API calls were immediately marked as deprecated, with no
+ * overlap.  We would therefore need to use #ifdef and always have
+ * some code that is deliberately not compiled, depending on the
+ * version of libslirp that we find on the user's system.  This is
+ * highly undesirable.
+ *
+ * Work around this by disabling the deprecation warning (which is
+ * what libslirp itself does for the portions of its code that
+ * necessarily touch the deprecated functions).
+ */
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 /**
  * Wrap slirp_new()
  *
@@ -487,6 +509,10 @@ linux_slirp_pollfds_poll ( struct Slirp *slirp, int select_error,
        slirp_pollfds_poll ( slirp, select_error, get_revents, opaque );
 }
 
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
 #endif /* HAVE_LIBSLIRP */
 
 /******************************************************************************