emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ab4f032: Avoid compiler warning in image.c on MS-Wi


From: Eli Zaretskii
Subject: [Emacs-diffs] master ab4f032: Avoid compiler warning in image.c on MS-Windows
Date: Wed, 14 Jun 2017 12:10:47 -0400 (EDT)

branch: master
commit ab4f0326b49e9c5a733b9e773b364f9b4afb1efc
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 429777c..aedec79 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]