emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master be90cd1: Avoid compiler warnings on MS-Windows with


From: Eli Zaretskii
Subject: [Emacs-diffs] master be90cd1: Avoid compiler warnings on MS-Windows with GCC 6 and 7
Date: Fri, 8 Sep 2017 04:01:25 -0400 (EDT)

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

    Avoid compiler warnings on MS-Windows with GCC 6 and 7
    
    * src/w32font.c (SUBRANGE): Use unsigned arithmetic for
    bit-shifting, to avoid compiler warnings.
    (w32font_text_extents): Tell GCC NGLYPHS is non-negative, to avoid
    a warning.  For details of the warning, see
    http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00093.html.
    * src/term.c (keys) [WINDOWSNT]: Don't define, as it is not used
    in that build.
    * src/sound.c (sound_perror): Ifdef away on WINDOWSNT, as this
    function is not used in that build.
    
    * configure.ac: Disable -Wsuggest-attribute=format on MS-Windows.
---
 configure.ac  | 3 ++-
 src/sound.c   | 3 +--
 src/term.c    | 2 +-
 src/w32font.c | 3 ++-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 250a517..8ffc7cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -976,9 +976,10 @@ AS_IF([test $gl_gcc_warnings = no],
     nw="$nw -Wmissing-braces"
   fi
 
-  # This causes too much noise in the MinGW build
+  # These cause too much noise in the MinGW build
   if test $opsys = mingw32; then
     nw="$nw -Wpointer-sign"
+    nw="$nw -Wsuggest-attribute=format"
   fi
 
   gl_MANYWARN_ALL_GCC([ws])
diff --git a/src/sound.c b/src/sound.c
index 4714ac1..75c27a9 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -293,6 +293,7 @@ static int do_play_sound (const char *, unsigned long);
 
 /* BEGIN: Common functions */
 
+#ifndef WINDOWSNT
 /* Like perror, but signals an error.  */
 
 static _Noreturn void
@@ -315,8 +316,6 @@ sound_perror (const char *msg)
     error ("%s", msg);
 }
 
-
-#ifndef WINDOWSNT
 /* Display a warning message.  */
 
 static void
diff --git a/src/term.c b/src/term.c
index 87a4126..c1d7b04 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1210,6 +1210,7 @@ struct fkey_table {
   const char *cap, *name;
 };
 
+#ifndef DOS_NT
   /* Termcap capability names that correspond directly to X keysyms.
      Some of these (marked "terminfo") aren't supplied by old-style
      (Berkeley) termcap entries.  They're listed in X keysym order;
@@ -1313,7 +1314,6 @@ static const struct fkey_table keys[] =
   {"!3", "S-undo"}       /*shifted undo key*/
   };
 
-#ifndef DOS_NT
 static char **term_get_fkeys_address;
 static KBOARD *term_get_fkeys_kboard;
 static Lisp_Object term_get_fkeys_1 (void);
diff --git a/src/w32font.c b/src/w32font.c
index 314d7ac..9881119 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -544,6 +544,7 @@ w32font_text_extents (struct font *font, unsigned *code,
      information.  */
 
   /* Make array big enough to hold surrogates.  */
+  eassume (0 <= nglyphs);      /* pacify GCC warning on next line */
   wcode = alloca (nglyphs * sizeof (WORD) * 2);
   for (i = 0; i < nglyphs; i++)
     {
@@ -2188,7 +2189,7 @@ font_supported_scripts (FONTSIGNATURE * sig)
 
   /* Match a single subrange. SYM is set if bit N is set in subranges.  */
 #define SUBRANGE(n,sym) \
-  if (subranges[(n) / 32] & (1 << ((n) % 32))) \
+  if (subranges[(n) / 32] & (1U << ((n) % 32))) \
     supported = Fcons ((sym), supported)
 
   /* Match multiple subranges. SYM is set if any MASK bit is set in



reply via email to

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