1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Merge with gnulib, pacifying GCC 7

This incorporates:
2017-05-16 manywarnings: update for GCC 7
2017-05-15 sys_select: Avoid "was expanded before it was required"
* configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
-Wformat-overflow=2 options, due to too many false alarms.
* doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
Copy from gnulib.
* m4/gnulib-comp.m4: Regenerate.
* src/coding.c (decode_coding_iso_2022):
Fix bug uncovered by -Wimplicit-fallthrough.
* src/conf_post.h (FALLTHROUGH): New macro.
Use it to mark all switch cases that fall through.
* src/editfns.c (styled_format): Use !, not ~, on bool.
* src/gtkutil.c (xg_check_special_colors):
When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
(xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
this bug was actually caught by Clang.
* src/search.c (boyer_moore):
Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
Tell GCC that glyph->u.glyphless.ch must be a character.
This commit is contained in:
Paul Eggert 2017-05-16 10:24:19 -07:00
parent 138c8256f4
commit 2e1bebe279
25 changed files with 118 additions and 70 deletions

View file

@ -921,6 +921,8 @@ AS_IF([test $gl_gcc_warnings = no],
[gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])])
AC_SUBST([WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS])
nw="$nw -Wduplicated-branches" # Too many false alarms
nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
nw="$nw -Woverlength-strings" # Not a problem these days nw="$nw -Woverlength-strings" # Not a problem these days
nw="$nw -Wformat-nonliteral" # we do this a lot nw="$nw -Wformat-nonliteral" # we do this a lot

View file

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex. % Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
% %
\def\texinfoversion{2017-04-14.11} \def\texinfoversion{2017-05-14.14}
% %
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@ -9118,7 +9118,13 @@ end
\xdef\safexrefname{#1}% \xdef\safexrefname{#1}%
}% }%
% %
\expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref \bgroup
\expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
\egroup
% We put the \gdef inside a group to avoid the definitions building up on
% TeX's save stack, which can cause it to run out of space for aux files with
% thousands of lines. \gdef doesn't use the save stack, but \csname does
% when it defines an unknown control sequence as \relax.
% %
% Was that xref control sequence that we just defined for a float? % Was that xref control sequence that we just defined for a float?
\expandafter\iffloat\csname XR\safexrefname\endcsname \expandafter\iffloat\csname XR\safexrefname\endcsname

View file

@ -3059,8 +3059,7 @@ class_definition (struct sym *containing, int tag, int flags, int nested)
MATCH until we see something like `;' or `{'. */ MATCH until we see something like `;' or `{'. */
while (!LOOKING_AT3 (';', YYEOF, '{')) while (!LOOKING_AT3 (';', YYEOF, '{'))
MATCH (); MATCH ();
done = 1; FALLTHROUGH;
case '{': case '{':
done = 1; done = 1;
break; break;
@ -3184,7 +3183,7 @@ declaration (int flags)
free (id); free (id);
return; return;
} }
FALLTHROUGH;
case '=': case '=':
/* Assumed to be the start of an initialization in this /* Assumed to be the start of an initialization in this
context. */ context. */

View file

@ -1157,7 +1157,7 @@ main (int argc, char **argv)
case 'c': case 'c':
/* Backward compatibility: support obsolete --ignore-case-regexp. */ /* Backward compatibility: support obsolete --ignore-case-regexp. */
optarg = concat (optarg, "i", ""); /* memory leak here */ optarg = concat (optarg, "i", ""); /* memory leak here */
/* FALLTHRU */ FALLTHROUGH;
case 'r': case 'r':
argbuffer[current_arg].arg_type = at_regexp; argbuffer[current_arg].arg_type = at_regexp;
argbuffer[current_arg].what = optarg; argbuffer[current_arg].what = optarg;
@ -1192,7 +1192,7 @@ main (int argc, char **argv)
case 't': typedefs = true; break; case 't': typedefs = true; break;
case 'T': typedefs = typedefs_or_cplusplus = true; break; case 'T': typedefs = typedefs_or_cplusplus = true; break;
case 'u': update = true; break; case 'u': update = true; break;
case 'v': vgrind_style = true; /*FALLTHRU*/ case 'v': vgrind_style = true; FALLTHROUGH;
case 'x': cxref_style = true; break; case 'x': cxref_style = true; break;
case 'w': no_warnings = true; break; case 'w': no_warnings = true; break;
default: default:
@ -2564,7 +2564,7 @@ hash (const char *str, int len)
{ {
default: default:
hval += asso_values[(unsigned char) str[2]]; hval += asso_values[(unsigned char) str[2]];
/*FALLTHROUGH*/ FALLTHROUGH;
case 2: case 2:
hval += asso_values[(unsigned char) str[1]]; hval += asso_values[(unsigned char) str[1]];
break; break;
@ -3013,7 +3013,7 @@ consider_token (char *str, int len, int c, int *c_extp,
*c_extp = (*c_extp | C_PLPL) & ~C_AUTO; *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
if (toktype == st_C_template) if (toktype == st_C_template)
break; break;
/* FALLTHRU */ FALLTHROUGH;
case st_C_struct: case st_C_struct:
case st_C_enum: case st_C_enum:
if (parlev == 0 if (parlev == 0
@ -3176,7 +3176,7 @@ consider_token (char *str, int len, int c, int *c_extp,
default: default:
break; break;
} }
/* FALLTHRU */ FALLTHROUGH;
case fvnameseen: case fvnameseen:
if (len >= 10 && strneq (str+len-10, "::operator", 10)) if (len >= 10 && strneq (str+len-10, "::operator", 10))
{ {
@ -3387,7 +3387,7 @@ C_entries (int c_ext, FILE *inf)
case '\0': case '\0':
/* Hmmm, something went wrong. */ /* Hmmm, something went wrong. */
CNL (); CNL ();
/* FALLTHRU */ FALLTHROUGH;
case '\'': case '\'':
inchar = false; inchar = false;
break; break;
@ -3828,7 +3828,7 @@ C_entries (int c_ext, FILE *inf)
|| (members || (members
&& plainc && instruct)) && plainc && instruct))
make_C_tag (true); /* a function */ make_C_tag (true); /* a function */
/* FALLTHRU */ FALLTHROUGH;
default: default:
fvextern = false; fvextern = false;
fvdef = fvnone; fvdef = fvnone;
@ -3838,7 +3838,7 @@ C_entries (int c_ext, FILE *inf)
else else
token.valid = false; token.valid = false;
} /* switch (fvdef) */ } /* switch (fvdef) */
/* FALLTHRU */ FALLTHROUGH;
default: default:
if (!instruct) if (!instruct)
typdef = tnone; typdef = tnone;
@ -3926,7 +3926,7 @@ C_entries (int c_ext, FILE *inf)
|| (globals && bracelev == 0 || (globals && bracelev == 0
&& (!fvextern || declarations))) && (!fvextern || declarations)))
make_C_tag (false); /* a variable */ make_C_tag (false); /* a variable */
/* FALLTHRU */ FALLTHROUGH;
default: default:
fvdef = fvnone; fvdef = fvnone;
} }
@ -3959,7 +3959,7 @@ C_entries (int c_ext, FILE *inf)
fvdef = fignore; fvdef = fignore;
break; break;
} }
/* FALLTHRU */ FALLTHROUGH;
case foperator: case foperator:
fvdef = fstartlist; fvdef = fstartlist;
break; break;
@ -4049,7 +4049,7 @@ C_entries (int c_ext, FILE *inf)
} }
} }
make_C_tag (true); /* a function */ make_C_tag (true); /* a function */
/* FALLTHRU */ FALLTHROUGH;
case fignore: case fignore:
fvdef = fvnone; fvdef = fvnone;
break; break;
@ -4142,7 +4142,7 @@ C_entries (int c_ext, FILE *inf)
if ((members && bracelev == 1) if ((members && bracelev == 1)
|| (globals && bracelev == 0 && (!fvextern || declarations))) || (globals && bracelev == 0 && (!fvextern || declarations)))
make_C_tag (false); /* a variable */ make_C_tag (false); /* a variable */
/* FALLTHRU */ FALLTHROUGH;
default: default:
fvdef = vignore; fvdef = vignore;
} }
@ -4169,7 +4169,7 @@ C_entries (int c_ext, FILE *inf)
objdef = omethodsign; objdef = omethodsign;
break; break;
} }
/* FALLTHRU */ FALLTHROUGH;
resetfvdef: resetfvdef:
case '#': case '~': case '&': case '%': case '/': case '#': case '~': case '&': case '%': case '/':
case '|': case '^': case '!': case '.': case '?': case '|': case '^': case '!': case '.': case '?':
@ -6354,7 +6354,7 @@ add_regex (char *regexp_pattern, language *lang)
break; break;
case 's': case 's':
single_line = true; single_line = true;
/* FALLTHRU */ FALLTHROUGH;
case 'm': case 'm':
multi_line = true; multi_line = true;
need_filebuf = true; need_filebuf = true;

View file

@ -68,6 +68,14 @@ extern char *tzname[];
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>
#ifndef FALLTHROUGH
# if __GNUC__ < 7
# define FALLTHROUGH ((void) 0)
# else
# define FALLTHROUGH __attribute__ ((__fallthrough__))
# endif
#endif
#ifdef COMPILE_WIDE #ifdef COMPILE_WIDE
# include <endian.h> # include <endian.h>
# define CHAR_T wchar_t # define CHAR_T wchar_t
@ -1138,8 +1146,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
#ifndef _NL_CURRENT #ifndef _NL_CURRENT
format_char = L_('p'); format_char = L_('p');
#endif #endif
/* FALLTHROUGH */ FALLTHROUGH;
case L_('p'): case L_('p'):
if (change_case) if (change_case)
{ {
@ -1474,7 +1481,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
case L_('\0'): /* GNU extension: % at end of format. */ case L_('\0'): /* GNU extension: % at end of format. */
--f; --f;
/* Fall through. */ FALLTHROUGH;
default: default:
/* Unknown format; output the format, including the '%', /* Unknown format; output the format, including the '%',
since this is most likely the right thing to do if a since this is most likely the right thing to do if a

View file

@ -375,7 +375,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([symlink]) AC_LIBOBJ([symlink])
fi fi
gl_UNISTD_MODULE_INDICATOR([symlink]) gl_UNISTD_MODULE_INDICATOR([symlink])
gl_HEADER_SYS_SELECT AC_REQUIRE([gl_HEADER_SYS_SELECT])
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
gl_HEADER_SYS_STAT_H gl_HEADER_SYS_STAT_H
AC_PROG_MKDIR_P AC_PROG_MKDIR_P

View file

@ -99,12 +99,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
# comm -3 \ # comm -3 \
# <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \ # <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
# <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort | # <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort |
# grep -v -x -f <( # grep -v -x -F -f <(
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec)) # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
gl_manywarn_set= gl_manywarn_set=
for gl_manywarn_item in \ for gl_manywarn_item in -fno-common \
-fno-common \
-W \ -W \
-Wabi \ -Wabi \
-Waddress \ -Waddress \
@ -113,6 +112,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wattributes \ -Wattributes \
-Wbad-function-cast \ -Wbad-function-cast \
-Wbool-compare \ -Wbool-compare \
-Wbool-operation \
-Wbuiltin-declaration-mismatch \
-Wbuiltin-macro-redefined \ -Wbuiltin-macro-redefined \
-Wcast-align \ -Wcast-align \
-Wchar-subscripts \ -Wchar-subscripts \
@ -122,6 +123,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wcomments \ -Wcomments \
-Wcoverage-mismatch \ -Wcoverage-mismatch \
-Wcpp \ -Wcpp \
-Wdangling-else \
-Wdate-time \ -Wdate-time \
-Wdeprecated \ -Wdeprecated \
-Wdeprecated-declarations \ -Wdeprecated-declarations \
@ -131,10 +133,13 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wdiscarded-qualifiers \ -Wdiscarded-qualifiers \
-Wdiv-by-zero \ -Wdiv-by-zero \
-Wdouble-promotion \ -Wdouble-promotion \
-Wduplicated-branches \
-Wduplicated-cond \ -Wduplicated-cond \
-Wduplicate-decl-specifier \
-Wempty-body \ -Wempty-body \
-Wendif-labels \ -Wendif-labels \
-Wenum-compare \ -Wenum-compare \
-Wexpansion-to-defined \
-Wextra \ -Wextra \
-Wformat-contains-nul \ -Wformat-contains-nul \
-Wformat-extra-args \ -Wformat-extra-args \
@ -155,6 +160,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Winit-self \ -Winit-self \
-Winline \ -Winline \
-Wint-conversion \ -Wint-conversion \
-Wint-in-bool-context \
-Wint-to-pointer-cast \ -Wint-to-pointer-cast \
-Winvalid-memory-model \ -Winvalid-memory-model \
-Winvalid-pch \ -Winvalid-pch \
@ -163,6 +169,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wlogical-op \ -Wlogical-op \
-Wmain \ -Wmain \
-Wmaybe-uninitialized \ -Wmaybe-uninitialized \
-Wmemset-elt-size \
-Wmemset-transposed-args \ -Wmemset-transposed-args \
-Wmisleading-indentation \ -Wmisleading-indentation \
-Wmissing-braces \ -Wmissing-braces \
@ -188,9 +195,12 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wpacked-bitfield-compat \ -Wpacked-bitfield-compat \
-Wparentheses \ -Wparentheses \
-Wpointer-arith \ -Wpointer-arith \
-Wpointer-compare \
-Wpointer-sign \ -Wpointer-sign \
-Wpointer-to-int-cast \ -Wpointer-to-int-cast \
-Wpragmas \ -Wpragmas \
-Wpsabi \
-Wrestrict \
-Wreturn-local-addr \ -Wreturn-local-addr \
-Wreturn-type \ -Wreturn-type \
-Wscalar-storage-order \ -Wscalar-storage-order \
@ -214,6 +224,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wswitch \ -Wswitch \
-Wswitch-bool \ -Wswitch-bool \
-Wswitch-default \ -Wswitch-default \
-Wswitch-unreachable \
-Wsync-nand \ -Wsync-nand \
-Wsystem-headers \ -Wsystem-headers \
-Wtautological-compare \ -Wtautological-compare \
@ -247,10 +258,18 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
# gcc --help=warnings outputs an unusual form for these options; list # gcc --help=warnings outputs an unusual form for these options; list
# them here so that the above 'comm' command doesn't report a false match. # them here so that the above 'comm' command doesn't report a false match.
# Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal:
ptrdiff_max_max=9223372036854775807
gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$ptrdiff_max_max"
gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2" gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc" gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2" gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2" gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031"
# These are needed for older GCC versions. # These are needed for older GCC versions.
if test -n "$GCC"; then if test -n "$GCC"; then

View file

@ -2092,7 +2092,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
type = RLI; type = RLI;
bidi_it->orig_type = type; bidi_it->orig_type = type;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case RLI: /* X5a */ case RLI: /* X5a */
if (override == NEUTRAL_DIR) if (override == NEUTRAL_DIR)
bidi_it->type_after_wn = type; bidi_it->type_after_wn = type;

View file

@ -690,6 +690,7 @@ invoke it. If KEYS is omitted or nil, the return value of
case 'N': /* Prefix arg as number, else number from minibuffer. */ case 'N': /* Prefix arg as number, else number from minibuffer. */
if (!NILP (prefix_arg)) if (!NILP (prefix_arg))
goto have_prefix_arg; goto have_prefix_arg;
FALLTHROUGH;
case 'n': /* Read number from minibuffer. */ case 'n': /* Read number from minibuffer. */
args[i] = call1 (Qread_number, callint_message); args[i] = call1 (Qread_number, callint_message);
/* Passing args[i] directly stimulates compiler bug. */ /* Passing args[i] directly stimulates compiler bug. */

View file

@ -1000,7 +1000,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
case CCL_ReadBranch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ case CCL_ReadBranch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
CCL_READ_CHAR (reg[rrr]); CCL_READ_CHAR (reg[rrr]);
/* fall through ... */ FALLTHROUGH;
case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
{ {
int ioff = 0 <= reg[rrr] && reg[rrr] < field1 ? reg[rrr] : field1; int ioff = 0 <= reg[rrr] && reg[rrr] < field1 ? reg[rrr] : field1;
@ -1174,6 +1174,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
case CCL_ReadJumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ case CCL_ReadJumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
CCL_READ_CHAR (reg[rrr]); CCL_READ_CHAR (reg[rrr]);
FALLTHROUGH;
case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
i = reg[rrr]; i = reg[rrr];
jump_address = ic + ADDR; jump_address = ic + ADDR;
@ -1184,6 +1185,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
case CCL_ReadJumpCondExprReg: /* A--D--D--R--E--S--S-rrrXXXXX */ case CCL_ReadJumpCondExprReg: /* A--D--D--R--E--S--S-rrrXXXXX */
CCL_READ_CHAR (reg[rrr]); CCL_READ_CHAR (reg[rrr]);
FALLTHROUGH;
case CCL_JumpCondExprReg: case CCL_JumpCondExprReg:
i = reg[rrr]; i = reg[rrr];
jump_address = ic + ADDR; jump_address = ic + ADDR;

View file

@ -3611,7 +3611,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
|| CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) || CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS)
goto invalid_code; goto invalid_code;
/* This is a graphic character, we fall down ... */ /* This is a graphic character, we fall down ... */
FALLTHROUGH;
case ISO_graphic_plane_1: case ISO_graphic_plane_1:
if (charset_id_1 < 0) if (charset_id_1 < 0)
goto invalid_code; goto invalid_code;
@ -3646,6 +3646,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
case ISO_single_shift_2_7: case ISO_single_shift_2_7:
if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS)) if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS))
goto invalid_code; goto invalid_code;
FALLTHROUGH;
case ISO_single_shift_2: case ISO_single_shift_2:
if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SINGLE_SHIFT)) if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SINGLE_SHIFT))
goto invalid_code; goto invalid_code;
@ -3797,6 +3798,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
{ {
case ']': /* end of the current direction */ case ']': /* end of the current direction */
coding->mode &= ~CODING_MODE_DIRECTION; coding->mode &= ~CODING_MODE_DIRECTION;
break;
case '0': /* end of the current direction */ case '0': /* end of the current direction */
case '1': /* start of left-to-right direction */ case '1': /* start of left-to-right direction */

View file

@ -244,6 +244,12 @@ extern int emacs_setenv_TZ (char const *);
# define ATTRIBUTE_FORMAT(spec) /* empty */ # define ATTRIBUTE_FORMAT(spec) /* empty */
#endif #endif
#if GNUC_PREREQ (7, 0, 0)
# define FALLTHROUGH __attribute__ ((__fallthrough__))
#else
# define FALLTHROUGH ((void) 0)
#endif
#if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__ #if GNUC_PREREQ (4, 4, 0) && defined __GLIBC_MINOR__
# define PRINTF_ARCHETYPE __gnu_printf__ # define PRINTF_ARCHETYPE __gnu_printf__
#elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__ #elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__

View file

@ -2153,7 +2153,7 @@ If the current binding is global (the default), the value is nil. */)
else if (!BUFFER_OBJFWDP (valcontents)) else if (!BUFFER_OBJFWDP (valcontents))
return Qnil; return Qnil;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case SYMBOL_LOCALIZED: case SYMBOL_LOCALIZED:
/* For a local variable, record both the symbol and which /* For a local variable, record both the symbol and which
buffer's or frame's value we are saving. */ buffer's or frame's value we are saving. */

View file

@ -352,6 +352,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
case 'S': case 'S':
string[-1] = 's'; string[-1] = 's';
FALLTHROUGH;
case 's': case 's':
if (fmtcpy[1] != 's') if (fmtcpy[1] != 's')
minlen = atoi (&fmtcpy[1]); minlen = atoi (&fmtcpy[1]);

View file

@ -1595,10 +1595,10 @@ time_arith (Lisp_Object a, Lisp_Object b,
{ {
default: default:
val = Fcons (make_number (t.ps), val); val = Fcons (make_number (t.ps), val);
/* Fall through. */ FALLTHROUGH;
case 3: case 3:
val = Fcons (make_number (t.us), val); val = Fcons (make_number (t.us), val);
/* Fall through. */ FALLTHROUGH;
case 2: case 2:
val = Fcons (make_number (t.lo), val); val = Fcons (make_number (t.lo), val);
val = Fcons (make_number (t.hi), val); val = Fcons (make_number (t.hi), val);
@ -4072,8 +4072,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
} }
/* Ignore flags when sprintf ignores them. */ /* Ignore flags when sprintf ignores them. */
space_flag &= ~ plus_flag; space_flag &= ! plus_flag;
zero_flag &= ~ minus_flag; zero_flag &= ! minus_flag;
char *num_end; char *num_end;
uintmax_t raw_field_width = strtoumax (format, &num_end, 10); uintmax_t raw_field_width = strtoumax (format, &num_end, 10);
@ -4311,7 +4311,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
{ {
memcpy (f, pMd, pMlen); memcpy (f, pMd, pMlen);
f += pMlen; f += pMlen;
zero_flag &= ~ precision_given; zero_flag &= ! precision_given;
} }
*f++ = conversion; *f++ = conversion;
*f = '\0'; *f = '\0';

View file

@ -3212,7 +3212,7 @@ do_specbind (struct Lisp_Symbol *sym, union specbinding *bind,
set_default_internal (specpdl_symbol (bind), value, bindflag); set_default_internal (specpdl_symbol (bind), value, bindflag);
return; return;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case SYMBOL_LOCALIZED: case SYMBOL_LOCALIZED:
set_internal (specpdl_symbol (bind), value, Qnil, bindflag); set_internal (specpdl_symbol (bind), value, Qnil, bindflag);
break; break;
@ -3390,12 +3390,10 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
Qnil, bindflag); Qnil, bindflag);
break; break;
} }
else
{ /* FALLTHROUGH!!
NOTE: we only ever come here if make_local_foo was used for
the first time on this var within this let. */
}
} }
/* Come here only if make_local_foo was used for the first time
on this var within this let. */
FALLTHROUGH;
case SPECPDL_LET_DEFAULT: case SPECPDL_LET_DEFAULT:
set_default_internal (specpdl_symbol (this_binding), set_default_internal (specpdl_symbol (this_binding),
specpdl_old_value (this_binding), specpdl_old_value (this_binding),
@ -3676,12 +3674,10 @@ backtrace_eval_unrewind (int distance)
SET_SYMBOL_VAL (XSYMBOL (sym), old_value); SET_SYMBOL_VAL (XSYMBOL (sym), old_value);
break; break;
} }
else
{ /* FALLTHROUGH!!
NOTE: we only ever come here if make_local_foo was used for
the first time on this var within this let. */
}
} }
/* Come here only if make_local_foo was used for the first
time on this var within this let. */
FALLTHROUGH;
case SPECPDL_LET_DEFAULT: case SPECPDL_LET_DEFAULT:
{ {
Lisp_Object sym = specpdl_symbol (tmp); Lisp_Object sym = specpdl_symbol (tmp);
@ -3837,7 +3833,7 @@ mark_specpdl (union specbinding *first, union specbinding *ptr)
case SPECPDL_LET_DEFAULT: case SPECPDL_LET_DEFAULT:
case SPECPDL_LET_LOCAL: case SPECPDL_LET_LOCAL:
mark_object (specpdl_where (pdl)); mark_object (specpdl_where (pdl));
/* Fall through. */ FALLTHROUGH;
case SPECPDL_LET: case SPECPDL_LET:
mark_object (specpdl_symbol (pdl)); mark_object (specpdl_symbol (pdl));
mark_object (specpdl_old_value (pdl)); mark_object (specpdl_old_value (pdl));

View file

@ -569,7 +569,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
if (! (boot[0] == '\200' && boot[1] == '\242')) if (! (boot[0] == '\200' && boot[1] == '\242'))
return -1; return -1;
boot += 2; boot += 2;
/* Fall through. */ FALLTHROUGH;
case ':': case ':':
if (! c_isdigit (boot[0])) if (! c_isdigit (boot[0]))
return -1; return -1;

View file

@ -605,6 +605,7 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
max_log_level, max_log_level,
"retry:", "retry:",
str); str);
FALLTHROUGH;
default: default:
GNUTLS_LOG2 (1, GNUTLS_LOG2 (1,
max_log_level, max_log_level,

View file

@ -554,10 +554,11 @@ xg_check_special_colors (struct frame *f,
else else
gtk_style_context_get_background_color (gsty, state, &col); gtk_style_context_get_background_color (gsty, state, &col);
sprintf (buf, "rgb:%04x/%04x/%04x", unsigned short
(unsigned) (col.red * 65535), r = col.red * 65535,
(unsigned) (col.green * 65535), g = col.green * 65535,
(unsigned) (col.blue * 65535)); b = col.blue * 65535;
sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
success_p = x_parse_color (f, buf, color) != 0; success_p = x_parse_color (f, buf, color) != 0;
#else #else
GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
@ -3856,7 +3857,6 @@ xg_update_scrollbar_pos (struct frame *f,
GtkWidget *wparent = gtk_widget_get_parent (wscroll); GtkWidget *wparent = gtk_widget_get_parent (wscroll);
gint msl; gint msl;
int scale = xg_get_gdk_scale (); int scale = xg_get_gdk_scale ();
bool hidden;
top /= scale; top /= scale;
left /= scale; left /= scale;
@ -3875,13 +3875,13 @@ xg_update_scrollbar_pos (struct frame *f,
/* Move and resize to new values. */ /* Move and resize to new values. */
gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL); gtk_widget_style_get (wscroll, "min-slider-length", &msl, NULL);
if (msl > height) bool hidden = height < msl;
if (hidden)
{ {
/* No room. Hide scroll bar as some themes output a warning if /* No room. Hide scroll bar as some themes output a warning if
the height is less than the min size. */ the height is less than the min size. */
gtk_widget_hide (wparent); gtk_widget_hide (wparent);
gtk_widget_hide (wscroll); gtk_widget_hide (wscroll);
hidden = true;
} }
else else
{ {

View file

@ -925,6 +925,7 @@ position_indentation (ptrdiff_t pos_byte)
case 0240: case 0240:
if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
return column; return column;
FALLTHROUGH;
case ' ': case ' ':
column++; column++;
break; break;

View file

@ -2309,6 +2309,7 @@ read_escape (Lisp_Object readcharfun, bool stringp)
c = READCHAR; c = READCHAR;
if (c != '-') if (c != '-')
error ("Invalid escape character syntax"); error ("Invalid escape character syntax");
FALLTHROUGH;
case '^': case '^':
c = READCHAR; c = READCHAR;
if (c == '\\') if (c == '\\')
@ -2399,6 +2400,7 @@ read_escape (Lisp_Object readcharfun, bool stringp)
case 'U': case 'U':
/* Post-Unicode-2.0: Up to eight hex chars. */ /* Post-Unicode-2.0: Up to eight hex chars. */
unicode_hex_count = 8; unicode_hex_count = 8;
FALLTHROUGH;
case 'u': case 'u':
/* A Unicode escape. We only permit them in strings and characters, /* A Unicode escape. We only permit them in strings and characters,
@ -3278,11 +3280,11 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
*pch = c; *pch = c;
return Qnil; return Qnil;
} }
/* Otherwise, we fall through! Note that the atom-reading loop
below will now loop at least once, assuring that we will not
try to UNREAD two characters in a row. */
} }
/* The atom-reading loop below will now loop at least once,
assuring that we will not try to UNREAD two characters in a
row. */
FALLTHROUGH;
default: default:
default_label: default_label:
if (c <= 040) goto retry; if (c <= 040) goto retry;

View file

@ -2636,6 +2636,7 @@ regex_compile (const_re_char *pattern, size_t size,
if ((syntax & RE_BK_PLUS_QM) if ((syntax & RE_BK_PLUS_QM)
|| (syntax & RE_LIMITED_OPS)) || (syntax & RE_LIMITED_OPS))
goto normal_char; goto normal_char;
FALLTHROUGH;
handle_plus: handle_plus:
case '*': case '*':
/* If there is no previous pattern... */ /* If there is no previous pattern... */
@ -3086,6 +3087,7 @@ regex_compile (const_re_char *pattern, size_t size,
with non-0. */ with non-0. */
if (regnum == 0) if (regnum == 0)
FREE_STACK_RETURN (REG_BADPAT); FREE_STACK_RETURN (REG_BADPAT);
FALLTHROUGH;
case '1': case '2': case '3': case '4': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
regnum = 10*regnum + (c - '0'); break; regnum = 10*regnum + (c - '0'); break;
@ -3905,8 +3907,7 @@ analyze_first (const_re_char *p, const_re_char *pend, char *fastmap,
j < (1 << BYTEWIDTH); j++) j < (1 << BYTEWIDTH); j++)
fastmap[j] = 1; fastmap[j] = 1;
} }
FALLTHROUGH;
/* Fallthrough */
case charset: case charset:
if (!fastmap) break; if (!fastmap) break;
not = (re_opcode_t) *(p - 1) == charset_not; not = (re_opcode_t) *(p - 1) == charset_not;
@ -6182,8 +6183,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
case on_failure_jump_nastyloop: case on_failure_jump_nastyloop:
assert ((re_opcode_t)pat[-2] == no_op); assert ((re_opcode_t)pat[-2] == no_op);
PUSH_FAILURE_POINT (pat - 2, str); PUSH_FAILURE_POINT (pat - 2, str);
/* Fallthrough */ FALLTHROUGH;
case on_failure_jump_loop: case on_failure_jump_loop:
case on_failure_jump: case on_failure_jump:
case succeed_n: case succeed_n:

View file

@ -1804,6 +1804,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
{ {
/* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a /* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a
byte following them are the target of translation. */ byte following them are the target of translation. */
eassume (0x80 <= char_base && char_base <= MAX_CHAR);
unsigned char str[MAX_MULTIBYTE_LENGTH]; unsigned char str[MAX_MULTIBYTE_LENGTH];
int cblen = CHAR_STRING (char_base, str); int cblen = CHAR_STRING (char_base, str);

View file

@ -810,6 +810,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
case Sstring_fence: case Sstring_fence:
case Scomment_fence: case Scomment_fence:
c = (code == Sstring_fence ? ST_STRING_STYLE : ST_COMMENT_STYLE); c = (code == Sstring_fence ? ST_STRING_STYLE : ST_COMMENT_STYLE);
FALLTHROUGH;
case Sstring: case Sstring:
/* Track parity of quotes. */ /* Track parity of quotes. */
if (string_style == -1) if (string_style == -1)
@ -2690,6 +2691,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
goto lose; goto lose;
INC_BOTH (from, from_byte); INC_BOTH (from, from_byte);
/* Treat following character as a word constituent. */ /* Treat following character as a word constituent. */
FALLTHROUGH;
case Sword: case Sword:
case Ssymbol: case Ssymbol:
if (depth || !sexpflag) break; if (depth || !sexpflag) break;
@ -2721,7 +2723,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
case Scomment_fence: case Scomment_fence:
comstyle = ST_COMMENT_STYLE; comstyle = ST_COMMENT_STYLE;
/* FALLTHROUGH */ FALLTHROUGH;
case Scomment: case Scomment:
if (!parse_sexp_ignore_comments) break; if (!parse_sexp_ignore_comments) break;
UPDATE_SYNTAX_TABLE_FORWARD (from); UPDATE_SYNTAX_TABLE_FORWARD (from);
@ -2753,7 +2755,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
goto close1; goto close1;
} }
mathexit = 1; mathexit = 1;
FALLTHROUGH;
case Sopen: case Sopen:
if (!++depth) goto done; if (!++depth) goto done;
break; break;
@ -2909,7 +2911,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
goto open2; goto open2;
} }
mathexit = 1; mathexit = 1;
FALLTHROUGH;
case Sclose: case Sclose:
if (!++depth) goto done2; if (!++depth) goto done2;
break; break;

View file

@ -2005,9 +2005,9 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
} }
else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE) else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
{ {
sprintf (buf, "%0*X", unsigned int ch = glyph->u.glyphless.ch;
glyph->u.glyphless.ch < 0x10000 ? 4 : 6, eassume (ch <= MAX_CHAR);
glyph->u.glyphless.ch + 0u); sprintf (buf, "%0*X", ch < 0x10000 ? 4 : 6, ch);
str = buf; str = buf;
} }
@ -8949,7 +8949,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{ {
case MappingModifier: case MappingModifier:
x_find_modifier_meanings (dpyinfo); x_find_modifier_meanings (dpyinfo);
/* This is meant to fall through. */ FALLTHROUGH;
case MappingKeyboard: case MappingKeyboard:
XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping); XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping);
} }