From ab4f0326b49e9c5a733b9e773b364f9b4afb1efc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 14 Jun 2017 19:09:21 +0300 Subject: [PATCH] Avoid compiler warning in image.c on MS-Windows * src/image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: Avoid compilation warning under -Warray-bounds by temporarily disabling the -Warray-bounds option. --- src/image.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/image.c b/src/image.c index 429777ce511..aedec7954ee 100644 --- a/src/image.c +++ b/src/image.c @@ -2041,10 +2041,20 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, (*ximg)->info.bmiColors[0].rgbGreen = 0; (*ximg)->info.bmiColors[0].rgbRed = 0; (*ximg)->info.bmiColors[0].rgbReserved = 0; + /* bmiColors is a variable-length array declared by w32api + headers as bmiColors[1], which triggers a warning under + -Warray-bounds; shut that up. */ +# if GNUC_PREREQ (4, 4, 0) +# pragma GCC push_options +# pragma GCC diagnostic ignored "-Warray-bounds" +# endif (*ximg)->info.bmiColors[1].rgbBlue = 255; (*ximg)->info.bmiColors[1].rgbGreen = 255; (*ximg)->info.bmiColors[1].rgbRed = 255; (*ximg)->info.bmiColors[1].rgbReserved = 0; +# if GNUC_PREREQ (4, 4, 0) +# pragma GCC pop_options +# endif } hdc = get_frame_dc (f); -- 2.39.2