Port to gcc -Wimplicit-fallthrough=5
* src/common.h (FALLTHROUGH): New macro, for use with gcc -Wimplicit-fallthrough=5, which is now the default when used with Gnulib after commit 2017-05-16T16:23:52!eggert@cs.ucla.edu and with --enable-gcc-warnings
This commit is contained in:
12
src/buffer.c
12
src/buffer.c
@@ -106,7 +106,7 @@ bool write_archive_to_stdout;
|
||||
/* When creating a multi-volume archive, each 'bufmap' represents
|
||||
a member stored (perhaps partly) in the current record buffer.
|
||||
Bufmaps are form a single-linked list in chronological order.
|
||||
|
||||
|
||||
After flushing the record to the output media, all bufmaps that
|
||||
represent fully written members are removed from the list, the
|
||||
nblocks and sizeleft values in the bufmap_head and start values
|
||||
@@ -1004,7 +1004,7 @@ void
|
||||
flush_archive (void)
|
||||
{
|
||||
size_t buffer_level;
|
||||
|
||||
|
||||
if (access_mode == ACCESS_READ && time_to_start_writing)
|
||||
{
|
||||
access_mode = ACCESS_WRITE;
|
||||
@@ -1296,8 +1296,7 @@ change_tape_menu (FILE *read_file)
|
||||
sys_spawn_shell ();
|
||||
break;
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
fprintf (stderr, _("Invalid input. Type ? for help.\n"));
|
||||
}
|
||||
@@ -1506,8 +1505,7 @@ try_new_volume (void)
|
||||
header = find_next_block ();
|
||||
if (header->header.typeflag != GNUTYPE_MULTIVOL)
|
||||
break;
|
||||
/* FALL THROUGH */
|
||||
|
||||
FALLTHROUGH;
|
||||
case GNUTYPE_MULTIVOL:
|
||||
if (!read_header0 (&dummy))
|
||||
return false;
|
||||
@@ -1532,7 +1530,7 @@ try_new_volume (void)
|
||||
quote (bufmap_head->file_name)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp (continued_file_name, bufmap_head->file_name))
|
||||
{
|
||||
if ((archive_format == GNU_FORMAT || archive_format == OLDGNU_FORMAT)
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
# define GLOBAL extern
|
||||
#endif
|
||||
|
||||
#if 7 <= __GNUC__
|
||||
# define FALLTHROUGH __attribute__ ((__fallthrough__))
|
||||
#else
|
||||
# define FALLTHROUGH ((void) 0)
|
||||
#endif
|
||||
|
||||
#define TAREXIT_SUCCESS PAXEXIT_SUCCESS
|
||||
#define TAREXIT_DIFFERS PAXEXIT_DIFFERS
|
||||
#define TAREXIT_FAILURE PAXEXIT_FAILURE
|
||||
|
||||
@@ -480,8 +480,7 @@ diff_archive (void)
|
||||
ERROR ((0, 0, _("%s: Unknown file type '%c', diffed as normal file"),
|
||||
quotearg_colon (current_stat_info.file_name),
|
||||
current_header->header.typeflag));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case AREGTYPE:
|
||||
case REGTYPE:
|
||||
case GNUTYPE_SPARSE:
|
||||
|
||||
11
src/delete.c
11
src/delete.c
@@ -187,8 +187,7 @@ delete_archive_members (void)
|
||||
skip_member ();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Fall through. */
|
||||
FALLTHROUGH;
|
||||
case HEADER_SUCCESS_EXTENDED:
|
||||
logical_status = status;
|
||||
break;
|
||||
@@ -199,7 +198,7 @@ delete_archive_members (void)
|
||||
set_next_block_after (current_header);
|
||||
break;
|
||||
}
|
||||
/* Fall through. */
|
||||
FALLTHROUGH;
|
||||
case HEADER_END_OF_FILE:
|
||||
logical_status = HEADER_END_OF_FILE;
|
||||
break;
|
||||
@@ -210,14 +209,12 @@ delete_archive_members (void)
|
||||
{
|
||||
case HEADER_STILL_UNREAD:
|
||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case HEADER_SUCCESS:
|
||||
case HEADER_SUCCESS_EXTENDED:
|
||||
case HEADER_ZERO_BLOCK:
|
||||
ERROR ((0, 0, _("Skipping to next header")));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case HEADER_FAILURE:
|
||||
break;
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ set_stat (char const *file_name,
|
||||
}
|
||||
|
||||
/* Find the direct ancestor of FILE_NAME in the delayed_set_stat list.
|
||||
*/
|
||||
*/
|
||||
static struct delayed_set_stat *
|
||||
find_direct_ancestor (char const *file_name)
|
||||
{
|
||||
@@ -758,10 +758,9 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
|
||||
break;
|
||||
stp = &st;
|
||||
}
|
||||
|
||||
/* The caller tried to open a symbolic link with O_NOFOLLOW.
|
||||
Fall through, treating it as an already-existing file. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case EEXIST:
|
||||
/* Remove an old file, if the options allow this. */
|
||||
|
||||
@@ -778,8 +777,7 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
|
||||
case KEEP_NEWER_FILES:
|
||||
if (file_newer_p (file_name, stp, ¤t_stat_info))
|
||||
break;
|
||||
/* FALL THROUGH */
|
||||
|
||||
FALLTHROUGH;
|
||||
case DEFAULT_OLD_FILES:
|
||||
case NO_OVERWRITE_DIR_OLD_FILES:
|
||||
case OVERWRITE_OLD_FILES:
|
||||
@@ -939,7 +937,7 @@ is_directory_link (const char *file_name)
|
||||
struct stat st;
|
||||
int e = errno;
|
||||
int res;
|
||||
|
||||
|
||||
res = (fstatat (chdir_fd, file_name, &st, AT_SYMLINK_NOFOLLOW) == 0 &&
|
||||
S_ISLNK (st.st_mode) &&
|
||||
fstatat (chdir_fd, file_name, &st, 0) == 0 &&
|
||||
@@ -1011,7 +1009,7 @@ extract_dir (char *file_name, int typeflag)
|
||||
|
||||
if (keep_directory_symlink_option && is_directory_link (file_name))
|
||||
return 0;
|
||||
|
||||
|
||||
if (deref_stat (file_name, &st) == 0)
|
||||
{
|
||||
current_mode = st.st_mode;
|
||||
|
||||
@@ -120,7 +120,7 @@ enforce_one_top_level (char **pfile_name)
|
||||
{
|
||||
char *file_name = *pfile_name;
|
||||
char *p;
|
||||
|
||||
|
||||
for (p = file_name; *p && (ISSLASH (*p) || *p == '.'); p++)
|
||||
;
|
||||
|
||||
@@ -132,7 +132,7 @@ enforce_one_top_level (char **pfile_name)
|
||||
if (ISSLASH (p[pos]) || p[pos] == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
*pfile_name = make_file_name (one_top_level_dir, file_name);
|
||||
normalize_filename_x (*pfile_name);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ read_and (void (*do_something) (void))
|
||||
if (show_omitted_dirs_option)
|
||||
WARN ((0, 0, _("%s: Omitting"),
|
||||
quotearg_colon (current_stat_info.file_name)));
|
||||
/* Fall through. */
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
skip_member ();
|
||||
continue;
|
||||
@@ -273,8 +273,7 @@ read_and (void (*do_something) (void))
|
||||
{
|
||||
case HEADER_STILL_UNREAD:
|
||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case HEADER_ZERO_BLOCK:
|
||||
case HEADER_SUCCESS:
|
||||
if (block_number_option)
|
||||
|
||||
24
src/names.c
24
src/names.c
@@ -146,7 +146,7 @@ static struct argp_option names_options[] = {
|
||||
{"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
|
||||
N_("wildcards do not match '/'"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -160,7 +160,7 @@ file_selection_option (int key)
|
||||
if (p->key == key)
|
||||
return p;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static char const *
|
||||
file_selection_option_name (int key)
|
||||
@@ -173,7 +173,7 @@ static bool
|
||||
is_file_selection_option (int key)
|
||||
{
|
||||
return file_selection_option (key) != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Either NL or NUL, as decided by the --null option. */
|
||||
static char filename_terminator = '\n';
|
||||
@@ -221,7 +221,7 @@ static int matching_flags = 0;
|
||||
/* exclude_fnmatch options */
|
||||
static int include_anchored = EXCLUDE_ANCHORED;
|
||||
/* Pattern anchoring options used for file inclusion */
|
||||
|
||||
|
||||
#define EXCLUDE_OPTIONS \
|
||||
(((wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
|
||||
| matching_flags \
|
||||
@@ -696,7 +696,7 @@ name_list_adjust (void)
|
||||
|
||||
For simplicity, only a tail pointer of the list is maintained.
|
||||
*/
|
||||
|
||||
|
||||
struct name_elt *unconsumed_option_tail;
|
||||
|
||||
/* Push an option to the list */
|
||||
@@ -729,7 +729,7 @@ unconsumed_option_report (void)
|
||||
if (unconsumed_option_tail)
|
||||
{
|
||||
struct name_elt *elt;
|
||||
|
||||
|
||||
ERROR ((0, 0, _("The following options were used after any non-optional arguments in archive create or update mode. These options are positional and affect only arguments that follow them. Please, rearrange them properly.")));
|
||||
|
||||
elt = unconsumed_option_tail;
|
||||
@@ -753,13 +753,13 @@ unconsumed_option_report (void)
|
||||
ERROR ((0, 0, _("--%s has no effect"),
|
||||
file_selection_option_name (elt->v.opt.option)));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
elt = elt->next;
|
||||
}
|
||||
|
||||
|
||||
unconsumed_option_free ();
|
||||
}
|
||||
}
|
||||
@@ -967,7 +967,7 @@ handle_option (const char *str, struct name_elt const *ent)
|
||||
struct wordsplit ws;
|
||||
int i;
|
||||
struct option_locus loc;
|
||||
|
||||
|
||||
while (*str && isspace (*str))
|
||||
++str;
|
||||
if (*str != '-')
|
||||
@@ -1025,7 +1025,7 @@ read_next_name (struct name_elt *ent, struct name_elt *ret)
|
||||
(0, 0, N_("%s: file name read contains nul character"),
|
||||
quotearg_colon (ent->v.file.name)));
|
||||
ent->v.file.term = 0;
|
||||
/* fall through */
|
||||
FALLTHROUGH;
|
||||
case file_list_success:
|
||||
if (!ent->v.file.verbatim)
|
||||
{
|
||||
@@ -1110,7 +1110,7 @@ name_next_elt (int change_dirs)
|
||||
name_list_advance ();
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
FALLTHROUGH;
|
||||
case NELT_NAME:
|
||||
copy_name (ep);
|
||||
if (unquote_option)
|
||||
@@ -1128,7 +1128,7 @@ name_next_elt (int change_dirs)
|
||||
}
|
||||
|
||||
unconsumed_option_report ();
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,11 +361,12 @@ sparse_scan_file (struct tar_sparse_file *file)
|
||||
/* fall back to "raw" for this and all other files */
|
||||
hole_detection = HOLE_DETECTION_RAW;
|
||||
#endif
|
||||
FALLTHROUGH;
|
||||
case HOLE_DETECTION_RAW:
|
||||
if (sparse_scan_file_raw (file))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1241,7 +1241,7 @@ parse_owner_group (char *arg, uintmax_t field_max, char const **name_option)
|
||||
u = u1;
|
||||
break;
|
||||
}
|
||||
/* Fall through. */
|
||||
FALLTHROUGH;
|
||||
case LONGINT_OVERFLOW:
|
||||
invalid_num = arg;
|
||||
break;
|
||||
@@ -1396,8 +1396,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
optloc_save (OC_LISTED_INCREMENTAL, args->loc);
|
||||
listed_incremental_option = arg;
|
||||
after_date_option = true;
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case 'G':
|
||||
/* We are making an incremental dump (FIXME: are we?); save
|
||||
directories at the beginning of the archive, and include in each
|
||||
@@ -1522,8 +1521,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
|
||||
case 'N':
|
||||
after_date_option = true;
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case NEWER_MTIME_OPTION:
|
||||
if (TIME_OPTION_INITIALIZED (newer_mtime_option))
|
||||
USAGE_ERROR ((0, 0, _("More than one threshold date")));
|
||||
@@ -2066,6 +2064,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
|
||||
argp_error (state,
|
||||
_("Options '-[0-7][lmh]' not supported by *this* tar"));
|
||||
exit (EX_USAGE);
|
||||
|
||||
#endif /* not DEVICE_PREFIX */
|
||||
|
||||
|
||||
@@ -186,13 +186,11 @@ update_archive (void)
|
||||
{
|
||||
case HEADER_STILL_UNREAD:
|
||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case HEADER_SUCCESS:
|
||||
case HEADER_ZERO_BLOCK:
|
||||
ERROR ((0, 0, _("Skipping to next header")));
|
||||
/* Fall through. */
|
||||
|
||||
FALLTHROUGH;
|
||||
case HEADER_FAILURE:
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user