emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 2e1bebe: Merge with gnulib, pacifying GCC 7


From: Paul Eggert
Subject: [Emacs-diffs] master 2e1bebe: Merge with gnulib, pacifying GCC 7
Date: Tue, 16 May 2017 13:27:48 -0400 (EDT)

branch: master
commit 2e1bebe279b7108f74c3a1e7e30e8a43c2cfa31f
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 configure.ac         |  2 ++
 doc/misc/texinfo.tex | 10 ++++++++--
 lib-src/ebrowse.c    |  5 ++---
 lib-src/etags.c      | 28 ++++++++++++++--------------
 lib/strftime.c       | 13 ++++++++++---
 m4/gnulib-comp.m4    |  2 +-
 m4/manywarnings.m4   | 25 ++++++++++++++++++++++---
 src/bidi.c           |  2 +-
 src/callint.c        |  1 +
 src/ccl.c            |  4 +++-
 src/coding.c         |  4 +++-
 src/conf_post.h      |  6 ++++++
 src/data.c           |  2 +-
 src/doprnt.c         |  1 +
 src/editfns.c        | 10 +++++-----
 src/eval.c           | 20 ++++++++------------
 src/filelock.c       |  2 +-
 src/gnutls.c         |  1 +
 src/gtkutil.c        | 14 +++++++-------
 src/indent.c         |  1 +
 src/lread.c          | 10 ++++++----
 src/regex.c          |  8 ++++----
 src/search.c         |  1 +
 src/syntax.c         |  8 +++++---
 src/xterm.c          |  8 ++++----
 25 files changed, 118 insertions(+), 70 deletions(-)

diff --git a/configure.ac b/configure.ac
index d085552..34b75a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -921,6 +921,8 @@ AS_IF([test $gl_gcc_warnings = no],
     [gl_WARN_ADD([-Werror], [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 -Woverlength-strings"     # Not a problem these days
   nw="$nw -Wformat-nonliteral"      # we do this a lot
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 9cd7310..8204f3e 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \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,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -9118,7 +9118,13 @@ end
     \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?
   \expandafter\iffloat\csname XR\safexrefname\endcsname
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 6239110..51d1819 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -3059,8 +3059,7 @@ class_definition (struct sym *containing, int tag, int 
flags, int nested)
                  MATCH until we see something like `;' or `{'.  */
               while (!LOOKING_AT3 (';', YYEOF, '{'))
                 MATCH ();
-             done = 1;
-
+             FALLTHROUGH;
             case '{':
               done = 1;
              break;
@@ -3184,7 +3183,7 @@ declaration (int flags)
              free (id);
              return;
            }
-
+         FALLTHROUGH;
         case '=':
           /* Assumed to be the start of an initialization in this
             context.  */
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 015cbbe..6f280d8 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1157,7 +1157,7 @@ main (int argc, char **argv)
       case 'c':
        /* Backward compatibility: support obsolete --ignore-case-regexp. */
        optarg = concat (optarg, "i", ""); /* memory leak here */
-       /* FALLTHRU */
+       FALLTHROUGH;
       case 'r':
        argbuffer[current_arg].arg_type = at_regexp;
        argbuffer[current_arg].what = optarg;
@@ -1192,7 +1192,7 @@ main (int argc, char **argv)
       case 't': typedefs = true;                               break;
       case 'T': typedefs = typedefs_or_cplusplus = 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 'w': no_warnings = true;                            break;
       default:
@@ -2564,7 +2564,7 @@ hash (const char *str, int len)
     {
       default:
         hval += asso_values[(unsigned char) str[2]];
-      /*FALLTHROUGH*/
+       FALLTHROUGH;
       case 2:
         hval += asso_values[(unsigned char) str[1]];
         break;
@@ -3013,7 +3013,7 @@ consider_token (char *str, int len, int c, int *c_extp,
         *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
        if (toktype == st_C_template)
         break;
-       /* FALLTHRU */
+       FALLTHROUGH;
      case st_C_struct:
      case st_C_enum:
        if (parlev == 0
@@ -3176,7 +3176,7 @@ consider_token (char *str, int len, int c, int *c_extp,
             default:
               break;
             }
-         /* FALLTHRU */
+          FALLTHROUGH;
          case fvnameseen:
          if (len >= 10 && strneq (str+len-10, "::operator", 10))
            {
@@ -3387,7 +3387,7 @@ C_entries (int c_ext, FILE *inf)
            case '\0':
              /* Hmmm, something went wrong. */
              CNL ();
-             /* FALLTHRU */
+             FALLTHROUGH;
            case '\'':
              inchar = false;
              break;
@@ -3828,7 +3828,7 @@ C_entries (int c_ext, FILE *inf)
                      || (members
                          && plainc && instruct))
                    make_C_tag (true);  /* a function */
-                 /* FALLTHRU */
+                 FALLTHROUGH;
                default:
                  fvextern = false;
                  fvdef = fvnone;
@@ -3838,7 +3838,7 @@ C_entries (int c_ext, FILE *inf)
                  else
                    token.valid = false;
                } /* switch (fvdef) */
-             /* FALLTHRU */
+             FALLTHROUGH;
            default:
              if (!instruct)
                typdef = tnone;
@@ -3926,7 +3926,7 @@ C_entries (int c_ext, FILE *inf)
                      || (globals && bracelev == 0
                          && (!fvextern || declarations)))
                    make_C_tag (false); /* a variable */
-                 /* FALLTHRU */
+                 FALLTHROUGH;
                default:
                  fvdef = fvnone;
                }
@@ -3959,7 +3959,7 @@ C_entries (int c_ext, FILE *inf)
                  fvdef = fignore;
                  break;
                }
-             /* FALLTHRU */
+             FALLTHROUGH;
            case foperator:
              fvdef = fstartlist;
              break;
@@ -4049,7 +4049,7 @@ C_entries (int c_ext, FILE *inf)
                    }
                }
              make_C_tag (true);    /* a function */
-             /* FALLTHRU */
+             FALLTHROUGH;
            case fignore:
              fvdef = fvnone;
              break;
@@ -4142,7 +4142,7 @@ C_entries (int c_ext, FILE *inf)
              if ((members && bracelev == 1)
                  || (globals && bracelev == 0 && (!fvextern || declarations)))
                make_C_tag (false); /* a variable */
-             /* FALLTHRU */
+             FALLTHROUGH;
            default:
              fvdef = vignore;
            }
@@ -4169,7 +4169,7 @@ C_entries (int c_ext, FILE *inf)
              objdef = omethodsign;
              break;
            }
-         /* FALLTHRU */
+         FALLTHROUGH;
        resetfvdef:
        case '#': case '~': case '&': case '%': case '/':
        case '|': case '^': case '!': case '.': case '?':
@@ -6354,7 +6354,7 @@ add_regex (char *regexp_pattern, language *lang)
        break;
       case 's':
        single_line = true;
-       /* FALLTHRU */
+       FALLTHROUGH;
       case 'm':
        multi_line = true;
        need_filebuf = true;
diff --git a/lib/strftime.c b/lib/strftime.c
index e4d78ef..99bee4e 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -68,6 +68,14 @@ extern char *tzname[];
 #include <string.h>
 #include <stdbool.h>
 
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+#  define FALLTHROUGH ((void) 0)
+# else
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
 #ifdef COMPILE_WIDE
 # include <endian.h>
 # define CHAR_T wchar_t
@@ -1138,8 +1146,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 #ifndef _NL_CURRENT
           format_char = L_('p');
 #endif
-          /* FALLTHROUGH */
-
+          FALLTHROUGH;
         case L_('p'):
           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.  */
             --f;
-            /* Fall through.  */
+            FALLTHROUGH;
         default:
           /* Unknown format; output the format, including the '%',
              since this is most likely the right thing to do if a
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 8295e48..3f196d4 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -375,7 +375,7 @@ AC_DEFUN([gl_INIT],
     AC_LIBOBJ([symlink])
   fi
   gl_UNISTD_MODULE_INDICATOR([symlink])
-  gl_HEADER_SYS_SELECT
+  AC_REQUIRE([gl_HEADER_SYS_SELECT])
   AC_PROG_MKDIR_P
   gl_HEADER_SYS_STAT_H
   AC_PROG_MKDIR_P
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 0f06ade..2d35eff 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -99,12 +99,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
   # comm -3 \
   #  <(sed -n 's/^  *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | 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))
 
   gl_manywarn_set=
-  for gl_manywarn_item in \
-    -fno-common \
+  for gl_manywarn_item in -fno-common \
     -W \
     -Wabi \
     -Waddress \
@@ -113,6 +112,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wattributes \
     -Wbad-function-cast \
     -Wbool-compare \
+    -Wbool-operation \
+    -Wbuiltin-declaration-mismatch \
     -Wbuiltin-macro-redefined \
     -Wcast-align \
     -Wchar-subscripts \
@@ -122,6 +123,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wcomments \
     -Wcoverage-mismatch \
     -Wcpp \
+    -Wdangling-else \
     -Wdate-time \
     -Wdeprecated \
     -Wdeprecated-declarations \
@@ -131,10 +133,13 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wdiscarded-qualifiers \
     -Wdiv-by-zero \
     -Wdouble-promotion \
+    -Wduplicated-branches \
     -Wduplicated-cond \
+    -Wduplicate-decl-specifier \
     -Wempty-body \
     -Wendif-labels \
     -Wenum-compare \
+    -Wexpansion-to-defined \
     -Wextra \
     -Wformat-contains-nul \
     -Wformat-extra-args \
@@ -155,6 +160,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Winit-self \
     -Winline \
     -Wint-conversion \
+    -Wint-in-bool-context \
     -Wint-to-pointer-cast \
     -Winvalid-memory-model \
     -Winvalid-pch \
@@ -163,6 +169,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wlogical-op \
     -Wmain \
     -Wmaybe-uninitialized \
+    -Wmemset-elt-size \
     -Wmemset-transposed-args \
     -Wmisleading-indentation \
     -Wmissing-braces \
@@ -188,9 +195,12 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wpacked-bitfield-compat \
     -Wparentheses \
     -Wpointer-arith \
+    -Wpointer-compare \
     -Wpointer-sign \
     -Wpointer-to-int-cast \
     -Wpragmas \
+    -Wpsabi \
+    -Wrestrict \
     -Wreturn-local-addr \
     -Wreturn-type \
     -Wscalar-storage-order \
@@ -214,6 +224,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
     -Wswitch \
     -Wswitch-bool \
     -Wswitch-default \
+    -Wswitch-unreachable \
     -Wsync-nand \
     -Wsystem-headers \
     -Wtautological-compare \
@@ -247,10 +258,18 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
 
   # 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.
+  # 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 -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 -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 -Wvla-larger-than=4031"
 
   # These are needed for older GCC versions.
   if test -n "$GCC"; then
diff --git a/src/bidi.c b/src/bidi.c
index b75ad93..dce0bf6 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -2092,7 +2092,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
          type = RLI;
          bidi_it->orig_type = type;
        }
-      /* FALLTHROUGH */
+      FALLTHROUGH;
     case RLI:  /* X5a */
       if (override == NEUTRAL_DIR)
        bidi_it->type_after_wn = type;
diff --git a/src/callint.c b/src/callint.c
index d964548..9643611 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -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.  */
          if (!NILP (prefix_arg))
            goto have_prefix_arg;
+         FALLTHROUGH;
        case 'n':               /* Read number from minibuffer.  */
          args[i] = call1 (Qread_number, callint_message);
          /* Passing args[i] directly stimulates compiler bug.  */
diff --git a/src/ccl.c b/src/ccl.c
index 90bd2f4..b2caf41 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1000,7 +1000,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int 
*destination, int src_size
 
        case CCL_ReadBranch:    /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
          CCL_READ_CHAR (reg[rrr]);
-         /* fall through ... */
+         FALLTHROUGH;
        case CCL_Branch:        /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
        {
          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 */
          CCL_READ_CHAR (reg[rrr]);
+         FALLTHROUGH;
        case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
          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 */
          CCL_READ_CHAR (reg[rrr]);
+         FALLTHROUGH;
        case CCL_JumpCondExprReg:
          i = reg[rrr];
          jump_address = ic + ADDR;
diff --git a/src/coding.c b/src/coding.c
index 367a975..5682fc0 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -3611,7 +3611,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
              || CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS)
            goto invalid_code;
          /* This is a graphic character, we fall down ... */
-
+         FALLTHROUGH;
        case ISO_graphic_plane_1:
          if (charset_id_1 < 0)
            goto invalid_code;
@@ -3646,6 +3646,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
        case ISO_single_shift_2_7:
          if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS))
            goto invalid_code;
+         FALLTHROUGH;
        case ISO_single_shift_2:
          if (! (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SINGLE_SHIFT))
            goto invalid_code;
@@ -3797,6 +3798,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
                {
                case ']':       /* end of the current direction */
                  coding->mode &= ~CODING_MODE_DIRECTION;
+                 break;
 
                case '0':       /* end of the current direction */
                case '1':       /* start of left-to-right direction */
diff --git a/src/conf_post.h b/src/conf_post.h
index 95ebd55..4fc0428 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -244,6 +244,12 @@ extern int emacs_setenv_TZ (char const *);
 # define ATTRIBUTE_FORMAT(spec) /* empty */
 #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__
 # define PRINTF_ARCHETYPE __gnu_printf__
 #elif GNUC_PREREQ (4, 4, 0) && defined __MINGW32__
diff --git a/src/data.c b/src/data.c
index 44f7ba0..3ff2a80 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2153,7 +2153,7 @@ If the current binding is global (the default), the value 
is nil.  */)
        else if (!BUFFER_OBJFWDP (valcontents))
          return Qnil;
       }
-      /* FALLTHROUGH */
+      FALLTHROUGH;
     case SYMBOL_LOCALIZED:
       /* For a local variable, record both the symbol and which
         buffer's or frame's value we are saving.  */
diff --git a/src/doprnt.c b/src/doprnt.c
index 09051ad..bed9350 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -352,6 +352,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
 
            case 'S':
              string[-1] = 's';
+             FALLTHROUGH;
            case 's':
              if (fmtcpy[1] != 's')
                minlen = atoi (&fmtcpy[1]);
diff --git a/src/editfns.c b/src/editfns.c
index 3853043..ecb8e3f 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1595,10 +1595,10 @@ time_arith (Lisp_Object a, Lisp_Object b,
     {
     default:
       val = Fcons (make_number (t.ps), val);
-      /* Fall through.  */
+      FALLTHROUGH;
     case 3:
       val = Fcons (make_number (t.us), val);
-      /* Fall through.  */
+      FALLTHROUGH;
     case 2:
       val = Fcons (make_number (t.lo), 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.  */
-         space_flag &= ~ plus_flag;
-         zero_flag &= ~ minus_flag;
+         space_flag &= ! plus_flag;
+         zero_flag &= ! minus_flag;
 
          char *num_end;
          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);
                    f += pMlen;
-                   zero_flag &= ~ precision_given;
+                   zero_flag &= ! precision_given;
                  }
                *f++ = conversion;
                *f = '\0';
diff --git a/src/eval.c b/src/eval.c
index 848955c..98d25cc 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3212,7 +3212,7 @@ do_specbind (struct Lisp_Symbol *sym, union specbinding 
*bind,
           set_default_internal (specpdl_symbol (bind), value, bindflag);
          return;
        }
-      /* FALLTHROUGH */
+      FALLTHROUGH;
     case SYMBOL_LOCALIZED:
       set_internal (specpdl_symbol (bind), value, Qnil, bindflag);
       break;
@@ -3390,12 +3390,10 @@ do_one_unbind (union specbinding *this_binding, bool 
unwinding,
                             Qnil, bindflag);
            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:
       set_default_internal (specpdl_symbol (this_binding),
                             specpdl_old_value (this_binding),
@@ -3676,12 +3674,10 @@ backtrace_eval_unrewind (int distance)
                SET_SYMBOL_VAL (XSYMBOL (sym), old_value);
                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:
          {
            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_LOCAL:
          mark_object (specpdl_where (pdl));
-         /* Fall through.  */
+         FALLTHROUGH;
        case SPECPDL_LET:
          mark_object (specpdl_symbol (pdl));
          mark_object (specpdl_old_value (pdl));
diff --git a/src/filelock.c b/src/filelock.c
index 67e8dbd..bfa1d63 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -569,7 +569,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
       if (! (boot[0] == '\200' && boot[1] == '\242'))
        return -1;
       boot += 2;
-      /* Fall through.  */
+      FALLTHROUGH;
     case ':':
       if (! c_isdigit (boot[0]))
        return -1;
diff --git a/src/gnutls.c b/src/gnutls.c
index 28ab10d..2078ad8 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -605,6 +605,7 @@ emacs_gnutls_handle_error (gnutls_session_t session, int 
err)
                        max_log_level,
                        "retry:",
                        str);
+         FALLTHROUGH;
         default:
           GNUTLS_LOG2 (1,
                        max_log_level,
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 1b63293..16eb284 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -554,10 +554,11 @@ xg_check_special_colors (struct frame *f,
     else
       gtk_style_context_get_background_color (gsty, state, &col);
 
-    sprintf (buf, "rgb:%04x/%04x/%04x",
-             (unsigned) (col.red * 65535),
-             (unsigned) (col.green * 65535),
-             (unsigned) (col.blue * 65535));
+    unsigned short
+      r = col.red * 65535,
+      g = col.green * 65535,
+      b = col.blue * 65535;
+    sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
     success_p = x_parse_color (f, buf, color) != 0;
 #else
     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);
       gint msl;
       int scale = xg_get_gdk_scale ();
-      bool hidden;
 
       top /= scale;
       left /= scale;
@@ -3875,13 +3875,13 @@ xg_update_scrollbar_pos (struct frame *f,
       /* Move and resize to new values.  */
       gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
       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
              the height is less than the min size.  */
           gtk_widget_hide (wparent);
           gtk_widget_hide (wscroll);
-         hidden = true;
         }
       else
         {
diff --git a/src/indent.c b/src/indent.c
index f630ebb..adecc36 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -925,6 +925,7 @@ position_indentation (ptrdiff_t pos_byte)
        case 0240:
          if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
            return column;
+         FALLTHROUGH;
        case ' ':
          column++;
          break;
diff --git a/src/lread.c b/src/lread.c
index c03aad4..5e737d6 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2309,6 +2309,7 @@ read_escape (Lisp_Object readcharfun, bool stringp)
       c = READCHAR;
       if (c != '-')
        error ("Invalid escape character syntax");
+      FALLTHROUGH;
     case '^':
       c = READCHAR;
       if (c == '\\')
@@ -2399,6 +2400,7 @@ read_escape (Lisp_Object readcharfun, bool stringp)
     case 'U':
       /* Post-Unicode-2.0: Up to eight hex chars.  */
       unicode_hex_count = 8;
+      FALLTHROUGH;
     case 'u':
 
       /* 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;
            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_label:
       if (c <= 040) goto retry;
diff --git a/src/regex.c b/src/regex.c
index 8e38a92..ed84890 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2636,6 +2636,7 @@ regex_compile (const_re_char *pattern, size_t size,
          if ((syntax & RE_BK_PLUS_QM)
              || (syntax & RE_LIMITED_OPS))
            goto normal_char;
+         FALLTHROUGH;
        handle_plus:
        case '*':
          /* If there is no previous pattern...  */
@@ -3086,6 +3087,7 @@ regex_compile (const_re_char *pattern, size_t size,
                                   with non-0. */
                                if (regnum == 0)
                                  FREE_STACK_RETURN (REG_BADPAT);
+                               FALLTHROUGH;
                              case '1': case '2': case '3': case '4':
                              case '5': case '6': case '7': case '8': case '9':
                                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++)
              fastmap[j] = 1;
          }
-
-         /* Fallthrough */
+         FALLTHROUGH;
        case charset:
          if (!fastmap) break;
          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:
              assert ((re_opcode_t)pat[-2] == no_op);
              PUSH_FAILURE_POINT (pat - 2, str);
-             /* Fallthrough */
-
+             FALLTHROUGH;
            case on_failure_jump_loop:
            case on_failure_jump:
            case succeed_n:
diff --git a/src/search.c b/src/search.c
index 1223cbf..19e789d 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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
         byte following them are the target of translation.  */
+      eassume (0x80 <= char_base && char_base <= MAX_CHAR);
       unsigned char str[MAX_MULTIBYTE_LENGTH];
       int cblen = CHAR_STRING (char_base, str);
 
diff --git a/src/syntax.c b/src/syntax.c
index 7aa43e6..dcaca22 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -810,6 +810,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, 
ptrdiff_t stop,
        case Sstring_fence:
        case Scomment_fence:
          c = (code == Sstring_fence ? ST_STRING_STYLE : ST_COMMENT_STYLE);
+         FALLTHROUGH;
        case Sstring:
          /* Track parity of quotes.  */
          if (string_style == -1)
@@ -2690,6 +2691,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
                goto lose;
              INC_BOTH (from, from_byte);
              /* Treat following character as a word constituent.  */
+             FALLTHROUGH;
            case Sword:
            case Ssymbol:
              if (depth || !sexpflag) break;
@@ -2721,7 +2723,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
 
            case Scomment_fence:
              comstyle = ST_COMMENT_STYLE;
-             /* FALLTHROUGH */
+             FALLTHROUGH;
            case Scomment:
              if (!parse_sexp_ignore_comments) break;
              UPDATE_SYNTAX_TABLE_FORWARD (from);
@@ -2753,7 +2755,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
                  goto close1;
                }
              mathexit = 1;
-
+             FALLTHROUGH;
            case Sopen:
              if (!++depth) goto done;
              break;
@@ -2909,7 +2911,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
                  goto open2;
                }
              mathexit = 1;
-
+             FALLTHROUGH;
            case Sclose:
              if (!++depth) goto done2;
              break;
diff --git a/src/xterm.c b/src/xterm.c
index e906883..c8836b7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2005,9 +2005,9 @@ x_draw_glyphless_glyph_string_foreground (struct 
glyph_string *s)
        }
       else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
        {
-         sprintf (buf, "%0*X",
-                  glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
-                  glyph->u.glyphless.ch + 0u);
+         unsigned int ch = glyph->u.glyphless.ch;
+         eassume (ch <= MAX_CHAR);
+         sprintf (buf, "%0*X", ch < 0x10000 ? 4 : 6, ch);
          str = buf;
        }
 
@@ -8949,7 +8949,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
         {
         case MappingModifier:
           x_find_modifier_meanings (dpyinfo);
-          /* This is meant to fall through.  */
+         FALLTHROUGH;
         case MappingKeyboard:
           XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping);
         }



reply via email to

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