From 689448a0418da3d3a15d137fa92f27d00c30624f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 27 May 2026 16:30:23 +0300 Subject: [PATCH] Unbreak MS-Windows build broken by Gnulib sync * src/conf_post.h: Add leading underscores to 'gl_consolesafe_*' functions, to follow Gnulib's renaming. * src/image.c (pbm_load, png_load_body, jpeg_load_body) (tiff_load): Revert previous change that removed "useless" casts, as removing them triggers warnings from MinGW GCC 9.2. --- src/conf_post.h | 26 +++++++++++++------------- src/image.c | 15 ++++++++------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/conf_post.h b/src/conf_post.h index 5b7548f20fa..20a9ce2609b 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -402,28 +402,28 @@ extern int emacs_setenv_TZ (char const *); Gnulib stdio-h module, which does the below in Gnulib's stdio.h file, which is not used by the MS-Windows build. */ -extern size_t gl_consolesafe_fwrite (const void *ptr, size_t size, - size_t nmemb, FILE *fp) +extern size_t _gl_consolesafe_fwrite (const void *ptr, size_t size, + size_t nmemb, FILE *fp) ARG_NONNULL ((1, 4)); -extern int gl_consolesafe_fprintf (FILE *restrict fp, - const char *restrict format, ...) +extern int _gl_consolesafe_fprintf (FILE *restrict fp, + const char *restrict format, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3) ARG_NONNULL ((1, 2)); -extern int gl_consolesafe_printf (const char *restrict format, ...) +extern int _gl_consolesafe_printf (const char *restrict format, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2) ARG_NONNULL ((1)); -extern int gl_consolesafe_vfprintf (FILE *restrict fp, - const char *restrict format, va_list args) +extern int _gl_consolesafe_vfprintf (FILE *restrict fp, + const char *restrict format, va_list args) ATTRIBUTE_FORMAT_PRINTF (2, 0) ARG_NONNULL ((1, 2)); -extern int gl_consolesafe_vprintf (const char *restrict format, va_list args) +extern int _gl_consolesafe_vprintf (const char *restrict format, va_list args) ATTRIBUTE_FORMAT_PRINTF (1, 0) ARG_NONNULL ((1)); -# define fwrite gl_consolesafe_fwrite -# define fprintf gl_consolesafe_fprintf -# define printf gl_consolesafe_printf -# define vfprintf gl_consolesafe_vfprintf -# define vprintf gl_consolesafe_vprintf +# define fwrite _gl_consolesafe_fwrite +# define fprintf _gl_consolesafe_fprintf +# define printf _gl_consolesafe_printf +# define vfprintf _gl_consolesafe_vfprintf +# define vprintf _gl_consolesafe_vprintf # endif /* !_UCRT */ # if !HAVE_DECL_GETDELIM diff --git a/src/image.c b/src/image.c index 640e3736b08..4d6affaf849 100644 --- a/src/image.c +++ b/src/image.c @@ -7840,7 +7840,8 @@ pbm_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - IMAGE_BACKGROUND (img, f, ximg); + /* Casting avoids a GCC warning. */ + IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -8586,7 +8587,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) img->height = height; /* Maybe fill in the background field while we have ximg handy. */ - IMAGE_BACKGROUND (img, f, ximg); + IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -8595,8 +8596,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) if (mask_img) { /* Fill in the background_transparent field while we have the - mask handy. */ - image_background_transparent (img, f, mask_img); + mask handy. Casting avoids a GCC warning. */ + image_background_transparent (img, f, (Emacs_Pix_Context)mask_img); image_put_x_image (f, img, mask_img, 1); } @@ -9163,7 +9164,7 @@ jpeg_load_body (struct frame *f, struct image *img, /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - IMAGE_BACKGROUND (img, f, ximg); + IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -9603,7 +9604,7 @@ tiff_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - IMAGE_BACKGROUND (img, f, ximg); + IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -10325,7 +10326,7 @@ gif_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - IMAGE_BACKGROUND (img, f, ximg); + IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0);