]> Savannah Git Hosting - gnulib.git/commitdiff
maint: update to work with GCC7's -Werror=implicit-fallthrough=
authorJim Meyering <meyering@fb.com>
Sat, 10 Jun 2017 17:11:47 +0000 (10:11 -0700)
committerJim Meyering <meyering@fb.com>
Sat, 10 Jun 2017 17:11:47 +0000 (10:11 -0700)
* lib/savewd.c (FALLTHROUGH): Define.
(savewd_save, savewd_restore): Use this, rather than a comment,
whenever one switch case falls through into the next.

ChangeLog
lib/savewd.c

index 19fa986e47afcda0306f00332b2cdf34ab2f85d6..abc3c174c38c8167c4ad956f1cff57e5e8d7a29b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-06-10  Jim Meyering  <meyering@fb.com>
+
+       maint: update to work with GCC7's -Werror=implicit-fallthrough=
+       * lib/savewd.c (FALLTHROUGH): Define.
+       (savewd_save, savewd_restore): Use this, rather than a comment,
+       whenever one switch case falls through into the next.
+
 2017-06-08  Bruno Haible  <bruno@clisp.org>
 
        host-cpu-c-abi: Support for aarch64 ILP32 ABI.
index 33fd85bd5c66f90de0e6917d3ad7aa1c50d8a304..4579d30664894a9efb5524b12b1b834eebb97659 100644 (file)
 #include "dosname.h"
 #include "fcntl-safer.h"
 
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+#  define FALLTHROUGH ((void) 0)
+# else
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif
+
 /* Save the working directory into *WD, if it hasn't been saved
    already.  Return true if a child has been forked to do the real
    work.  */
@@ -63,7 +71,7 @@ savewd_save (struct savewd *wd)
       }
       wd->state = FORKING_STATE;
       wd->val.child = -1;
-      /* Fall through.  */
+      FALLTHROUGH;
     case FORKING_STATE:
       if (wd->val.child < 0)
         {
@@ -188,7 +196,7 @@ savewd_restore (struct savewd *wd, int status)
           wd->state = ERROR_STATE;
           wd->val.errnum = chdir_errno;
         }
-      /* Fall through.  */
+      FALLTHROUGH;
     case ERROR_STATE:
       /* Report an error if asked to restore the working directory.  */
       errno = wd->val.errnum;