]> Savannah Git Hosting - gnulib.git/commitdiff
Silence warnings from clang 10 with -Wimplicit-fallthrough.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 18:09:36 +0000 (20:09 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 18:09:36 +0000 (20:09 +0200)
* lib/dfa.c (FALLTHROUGH): Use __attribute__ __fallthrough__ also on
clang >= 10.
* lib/fnmatch.c (FALLTHROUGH): Likewise.
* lib/fts.c (FALLTHROUGH): Likewise.
* tests/macros.h (FALLTHROUGH): Likewise.
* lib/regex_internal.h (FALLTHROUGH): Likewise.
* config/srclist.txt: Mark it as needing sync with glibc.

ChangeLog
config/srclist.txt
lib/dfa.c
lib/fnmatch.c
lib/fts.c
lib/regex_internal.h
tests/macros.h

index b1fd086405830e981b3836be48ae04a915365884..10697a729ff8bd09b1033fdba6f50efa531e4cda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-08-09  Bruno Haible  <bruno@clisp.org>
+
+       Silence warnings from clang 10 with -Wimplicit-fallthrough.
+       * lib/dfa.c (FALLTHROUGH): Use __attribute__ __fallthrough__ also on
+       clang >= 10.
+       * lib/fnmatch.c (FALLTHROUGH): Likewise.
+       * lib/fts.c (FALLTHROUGH): Likewise.
+       * tests/macros.h (FALLTHROUGH): Likewise.
+       * lib/regex_internal.h (FALLTHROUGH): Likewise.
+       * config/srclist.txt: Mark it as needing sync with glibc.
+
 2020-08-09  Bruno Haible  <bruno@clisp.org>
 
        stdbool tests: Enable the stricter tests also on clang.
index 58b34d79ec8f245e185aa1a77528692489af8bf9..429cb949e7db78bd9b3db43af7f9a6b5e2087b1e 100644 (file)
@@ -58,7 +58,7 @@ $LIBCSRC posix/regcomp.c              lib
 $LIBCSRC posix/regex.c                 lib
 $LIBCSRC posix/regex.h                 lib
 $LIBCSRC posix/regex_internal.c                lib
-$LIBCSRC posix/regex_internal.h                lib
+#$LIBCSRC posix/regex_internal.h               lib
 $LIBCSRC posix/regexec.c               lib
 $LIBCSRC time/timegm.c                 lib
 $LIBCSRC time/mktime.c                 lib
index e79d882d764c617b26962a5f2dc37478888f8f9e..1f0587a7a338b81cfdac8d4d32ff964846a53d7d 100644 (file)
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -64,10 +64,10 @@ isasciidigit (char c)
 #ifndef FALLTHROUGH
 # if 201710L < __STDC_VERSION__
 #  define FALLTHROUGH [[__fallthrough__]]
-# elif __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
+# elif (__GNUC__ >= 7) || (__clang_major__ >= 10)
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
 # endif
 #endif
 
index 4d017cfebea2e02b67aa6deac7a397f2a1b280aa..30144286f33721c1b78519ce22ce5f36c62c86ee 100644 (file)
@@ -64,10 +64,10 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
 #endif
 
 #ifdef _LIBC
-# if __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
+# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
 # endif
 #else
 # include "attribute.h"
index a34092ca2520e7d6735a65499a6bf5e1f8e67d94..a7deaa040190bdc964af1c9f9b3392de61178621 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -201,10 +201,10 @@ enum Fts_stat
 #endif
 
 #ifndef FALLTHROUGH
-# if __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
+# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
 # endif
 #endif
 
index 8c42586c4212e34887faf6231a607a42397094ab..df5303cb4d9b3044e0b90edc0c330ad03e4a5abf 100644 (file)
@@ -841,10 +841,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
 #endif /* RE_ENABLE_I18N */
 
 #ifndef FALLTHROUGH
-# if __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
+# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
 # endif
 #endif
 
index c72cc922898b0b3713ada434c44ba71af14176ce..bbc340d41a5a39e92c39f174532bd93843ff7a31 100644 (file)
 #include <stdlib.h>
 
 #ifndef FALLTHROUGH
-# if __GNUC__ < 7
-#  define FALLTHROUGH ((void) 0)
-# else
+# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# else
+#  define FALLTHROUGH ((void) 0)
 # endif
 #endif