* lib/quotearg.c (FALLTHROUGH): New macro.
Use it whenever one switch case falls through into the next,
replacing "/* Fall through */" comments. This exposed one
instance of an unwarranted "fall through" comment: unwarranted
because it preceded a "goto" label not a case statement.
* lib/freopen-safer.c (freopen_safer): Likewise.
* lib/fts.c (leaf_optimization_applies): Likewise.
* lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise.
* tests/test-getopt_long.h (getopt_long_loop): Likewise.
* tests/test-tsearch.c (mangle_tree): Likewise. Also include
tests/macros.h for the definition.
* tests/test-argp.c (group1_parser): Likewise.
* tests/test-getopt.h (getopt_loop): Likewise.
+2017-05-18 Jim Meyering <meyering@fb.com>
+
+ fallthrough: update for GCC 7/8
+ * lib/quotearg.c (FALLTHROUGH): New macro.
+ Use it whenever one switch case falls through into the next,
+ replacing "/* Fall through */" comments. This exposed one
+ instance of an unwarranted "fall through" comment: unwarranted
+ because it preceded a "goto" label not a case statement.
+ * lib/freopen-safer.c (freopen_safer): Likewise.
+ * lib/fts.c (leaf_optimization_applies): Likewise.
+ * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise.
+ * tests/test-getopt_long.h (getopt_long_loop): Likewise.
+ * tests/test-tsearch.c (mangle_tree): Likewise. Also include
+ tests/macros.h for the definition.
+ * tests/test-argp.c (group1_parser): Likewise.
+ * tests/test-getopt.h (getopt_loop): Likewise.
+
2017-05-19 Paul Eggert <eggert@cs.ucla.edu>
argp: fix shift bug
#include <stdbool.h>
#include <unistd.h>
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+# define FALLTHROUGH ((void) 0)
+# else
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
/* Guarantee that FD is open; all smaller FDs must already be open.
Return true if successful. */
static bool
default: /* -1 or not a standard stream. */
if (dup2 (STDERR_FILENO, STDERR_FILENO) != STDERR_FILENO)
protect_err = true;
- /* fall through */
+ FALLTHROUGH;
case STDERR_FILENO:
if (dup2 (STDOUT_FILENO, STDOUT_FILENO) != STDOUT_FILENO)
protect_out = true;
- /* fall through */
+ FALLTHROUGH;
case STDOUT_FILENO:
if (dup2 (STDIN_FILENO, STDIN_FILENO) != STDIN_FILENO)
protect_in = true;
- /* fall through */
+ FALLTHROUGH;
case STDIN_FILENO:
/* Nothing left to protect. */
break;
while (false)
#endif
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+# define FALLTHROUGH ((void) 0)
+# else
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
static FTSENT *fts_alloc (FTS *, const char *, size_t) internal_function;
static FTSENT *fts_build (FTS *, int) internal_function;
static void fts_lfree (FTSENT *) internal_function;
of large directories, so as per <https://bugzilla.redhat.com/1252549>
NFS should return true. However st_nlink values are not accurate on
all implementations as per <https://bugzilla.redhat.com/1299169>. */
- /* fall through */
+ FALLTHROUGH;
case S_MAGIC_PROC:
/* Per <http://bugs.debian.org/143111> /proc may have
bogus stat.st_nlink values. */
- /* fall through */
+ FALLTHROUGH;
default:
return false;
}
#define INT_BITS (sizeof (int) * CHAR_BIT)
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+# define FALLTHROUGH ((void) 0)
+# else
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
struct quoting_options
{
/* Basic quoting style. */
case c_maybe_quoting_style:
quoting_style = c_quoting_style;
elide_outer_quotes = true;
- /* Fall through. */
+ FALLTHROUGH;
case c_quoting_style:
if (!elide_outer_quotes)
STORE ('"');
case shell_escape_quoting_style:
backslash_escapes = true;
- /* Fall through. */
+ FALLTHROUGH;
case shell_quoting_style:
elide_outer_quotes = true;
- /* Fall through. */
+ FALLTHROUGH;
case shell_escape_always_quoting_style:
if (!elide_outer_quotes)
backslash_escapes = true;
- /* Fall through. */
+ FALLTHROUGH;
case shell_always_quoting_style:
quoting_style = shell_always_quoting_style;
if (!elide_outer_quotes)
if (quoting_style == shell_always_quoting_style
&& elide_outer_quotes)
goto force_outer_quoting_style;
- /* Fall through. */
c_escape:
if (backslash_escapes)
{
case '{': case '}': /* sometimes special if isolated */
if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
break;
- /* Fall through. */
+ FALLTHROUGH;
case '#': case '~':
if (i != 0)
break;
- /* Fall through. */
+ FALLTHROUGH;
case ' ':
c_and_shell_quote_compat = true;
- /* Fall through. */
+ FALLTHROUGH;
case '!': /* special in bash */
case '"': case '$': case '&':
case '(': case ')': case '*': case ';':
/* Specification. */
#include "unistr.h"
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+# define FALLTHROUGH ((void) 0)
+# else
+# define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n)
{
switch (count) /* note: code falls through cases! */
{
case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
- /* fallthrough */
+ FALLTHROUGH;
case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
- /* fallthrough */
+ FALLTHROUGH;
case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;
/*case 1:*/ s[0] = uc;
}
# include <strings.h>
#endif
+#include "macros.h"
+
struct test_args
{
int test;
case 'r':
args->read = 1;
- /* fall through */
+ FALLTHROUGH;
case 'f':
args->file = arg;
break;
/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
#include <stdbool.h>
+#include "macros.h"
/* The glibc/gnulib implementation of getopt supports setting optind =
0, but not all other implementations do. This matters for getopt.
ASSERT (options[0] == ':'
|| ((options[0] == '-' || options[0] == '+')
&& options[1] == ':'));
- /* fall through */
+ FALLTHROUGH;
case '?':
*unrecognized = optopt;
break;
ASSERT (options[0] == ':'
|| ((options[0] == '-' || options[0] == '+')
&& options[1] == ':'));
- /* fall through */
+ FALLTHROUGH;
case '?':
*unrecognized = optopt;
break;
#include <stdlib.h>
#include <string.h>
+#include "macros.h"
+
#define SEED 0
#if HAVE_TSEARCH
/* The system's tsearch() is not expected to keep the tree balanced. */
break;
j = k;
- /* fall through */
+ FALLTHROUGH;
case delete:
elem = tfind (x + j, (void *const *) root, cmp_fn);