From 5d310e00599c11f1ea3cfef896fb524dbf40d1fe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 13 Feb 2026 17:37:50 -0800 Subject: [PATCH] Pacify GCC with gdk-pixbuf 2.44 * src/pgtkfns.c (xg_set_icon_from_xpm_data): * src/xfns.c (xg_set_icon_from_xpm_data): gdk-pixbuf 2.44 (2025-09) deprecated xg_set_icon_from_xpm_data, and this breaks --enable-gcc-warnings builds. For now, pacify GCC by using a pragma. --- src/pgtkfns.c | 17 +++++++++++++++++ src/xfns.c | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/pgtkfns.c b/src/pgtkfns.c index c336ce36d58..630175b2283 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -769,8 +769,25 @@ xg_set_icon (struct frame *f, Lisp_Object file) bool xg_set_icon_from_xpm_data (struct frame *f, const char **data) { + /* gdk-pixbuf 2.44 deprecated gdk_pixbuf_new_from_xpm_data. + Emacs should convert assets to PNG and use gdk_pixbuf_new_from_stream + with a GMemoryInputStream, or transition to PNG via GResource. + Pacify GCC for now. */ +#if (defined GDK_PIXBUF_VERSION_2_44 \ + && GDK_PIXBUF_VERSION_2_44 <= GDK_PIXBUF_VERSION_MIN_REQUIRED \ + && GNUC_PREREQ (4, 6, 0)) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); +#if (defined GDK_PIXBUF_VERSION_2_44 \ + && GDK_PIXBUF_VERSION_2_44 <= GDK_PIXBUF_VERSION_MIN_REQUIRED \ + && GNUC_PREREQ (4, 6, 0)) +# pragma GCC diagnostic pop +#endif + if (!pixbuf) return false; diff --git a/src/xfns.c b/src/xfns.c index f960f36e24d..87ce3af30d7 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1146,8 +1146,25 @@ xg_set_icon (struct frame *f, Lisp_Object file) bool xg_set_icon_from_xpm_data (struct frame *f, const char **data) { + /* gdk-pixbuf 2.44 deprecated gdk_pixbuf_new_from_xpm_data. + Emacs should convert assets to PNG and use gdk_pixbuf_new_from_stream + with a GMemoryInputStream, or transition to PNG via GResource. + Pacify GCC for now. */ +#if (defined GDK_PIXBUF_VERSION_2_44 \ + && GDK_PIXBUF_VERSION_2_44 <= GDK_PIXBUF_VERSION_MIN_REQUIRED \ + && GNUC_PREREQ (4, 6, 0)) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); +#if (defined GDK_PIXBUF_VERSION_2_44 \ + && GDK_PIXBUF_VERSION_2_44 <= GDK_PIXBUF_VERSION_MIN_REQUIRED \ + && GNUC_PREREQ (4, 6, 0)) +# pragma GCC diagnostic pop +#endif + if (!pixbuf) return false;