From: Eli Zaretskii Date: Fri, 8 Sep 2017 08:00:34 +0000 (+0300) Subject: Avoid compiler warnings on MS-Windows with GCC 6 and 7 X-Git-Tag: emacs-26.0.90~232 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=be90cd1412c89cae6b2ba41133b888008ee478dc;p=emacs.git 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. --- diff --git a/configure.ac b/configure.ac index 250a51725b3..8ffc7cfff3d 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 4714ac1796b..75c27a97f4d 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 87a412666d0..c1d7b0483e7 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 314d7acdcc6..98811192029 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