summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-15 17:22:01 +0200
committerJim Meyering <meyering@redhat.com>2009-09-11 14:08:58 +0200
commit9966c92dd4851db611ad88fc1eb68b01fffcaea3 (patch)
treefb1056a4b7a0814e4efdc798bdace345acd24180
parent4f73ecaf7def2a7bdc381eee2036f6539df01e7d (diff)
downloadcoreutils-9966c92dd4851db611ad88fc1eb68b01fffcaea3.tar.xz
build: placate gcc's new -Wskip-jump-init
* remove.c (rm_fts): Put braces around each of the two offending blocks. * configure.ac: Don't turn off -Wjump-misses-init. With the rewrite of remove.c, it is no longer needed.
-rw-r--r--configure.ac3
-rw-r--r--src/remove.c73
2 files changed, 38 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index e718b36b3..fa82b4c09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,9 +101,6 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
- # Offenders in pre-fts remove.c; FIXME: remove upon remove.c rewrite
- gl_WARN_ADD([-Wno-jump-misses-init])
-
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
gl_WARN_ADD([-Wno-logical-op])
diff --git a/src/remove.c b/src/remove.c
index 137be22ca..32f67a181 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -493,25 +493,27 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
}
}
- Ternary is_empty_directory;
- enum RM_status s = prompt (fts, ent, true /*is_dir*/, x,
- PA_DESCEND_INTO_DIR, &is_empty_directory);
+ {
+ Ternary is_empty_directory;
+ enum RM_status s = prompt (fts, ent, true /*is_dir*/, x,
+ PA_DESCEND_INTO_DIR, &is_empty_directory);
- if (s == RM_OK && is_empty_directory == T_YES)
- {
- /* When we know (from prompt when in interactive mode)
- that this is an empty directory, don't prompt twice. */
- s = excise (fts, ent, x, true);
- fts_skip_tree (fts, ent);
- }
+ if (s == RM_OK && is_empty_directory == T_YES)
+ {
+ /* When we know (from prompt when in interactive mode)
+ that this is an empty directory, don't prompt twice. */
+ s = excise (fts, ent, x, true);
+ fts_skip_tree (fts, ent);
+ }
- if (s != RM_OK)
- {
- mark_ancestor_dirs (ent);
- fts_skip_tree (fts, ent);
- }
+ if (s != RM_OK)
+ {
+ mark_ancestor_dirs (ent);
+ fts_skip_tree (fts, ent);
+ }
- return s;
+ return s;
+ }
case FTS_F: /* regular file */
case FTS_NS: /* stat(2) failed */
@@ -521,26 +523,27 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
case FTS_DNR: /* unreadable directory */
case FTS_NSOK: /* e.g., dangling symlink */
case FTS_DEFAULT: /* none of the above */
- ;
- /* With --one-file-system, do not attempt to remove a mount point.
- fts' FTS_XDEV ensures that we don't process any entries under
- the mount point. */
- if (ent->fts_info == FTS_DP
- && x->one_file_system
- && FTS_ROOTLEVEL < ent->fts_level
- && ent->fts_statp->st_ino != fts->fts_dev)
- {
- mark_ancestor_dirs (ent);
- error (0, 0, _("skipping %s, since it's on a different device"),
- quote (ent->fts_path));
- return RM_ERROR;
- }
+ {
+ /* With --one-file-system, do not attempt to remove a mount point.
+ fts' FTS_XDEV ensures that we don't process any entries under
+ the mount point. */
+ if (ent->fts_info == FTS_DP
+ && x->one_file_system
+ && FTS_ROOTLEVEL < ent->fts_level
+ && ent->fts_statp->st_ino != fts->fts_dev)
+ {
+ mark_ancestor_dirs (ent);
+ error (0, 0, _("skipping %s, since it's on a different device"),
+ quote (ent->fts_path));
+ return RM_ERROR;
+ }
- bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
- s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
- if (s != RM_OK)
- return s;
- return excise (fts, ent, x, is_dir);
+ bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
+ enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
+ if (s != RM_OK)
+ return s;
+ return excise (fts, ent, x, is_dir);
+ }
case FTS_DC: /* directory that causes cycles */
error (0, 0, _("\