]> Savannah Git Hosting - gnulib.git/commitdiff
fnmatch, regex, fts: FALLTHROUGH consistency
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Jan 2021 02:35:30 +0000 (18:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Jan 2021 02:37:02 +0000 (18:37 -0800)
Be more consistent about how FALLTHROUGH is defined.
For Gnulib, use attribute.h.  For glibc, use __GNUC__ >= 7.
Problem for glibc reported by Vaseeharan Vinayagamoorthy in:
https://sourceware.org/pipermail/libc-alpha/2021-January/121778.html
* lib/fnmatch.c (FALLTHROUGH) [_LIBC]:
* lib/regex_internal.h (FALLTHROUGH) [_LIBC]:
Don’t worry about Clang, as it’s not needed and provokes GCC.
* lib/fts.c (FALLTHROUGH) [!_LIBC]:
* lib/regex_internal.h (FALLTHROUGH) [!_LIBC]:
Rely on attribute.h for FALLTHROUGH
* modules/regex: Depend on attribute module.

ChangeLog
lib/fnmatch.c
lib/fts.c
lib/regex_internal.h
modules/regex

index 269577caa063a4b3a6cff58a53316bdc0ab48ad9..290fa1b4cb8504e3476436d2a5e9ff987d9fb6ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2021-01-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       fnmatch, regex, fts: FALLTHROUGH consistency
+       Be more consistent about how FALLTHROUGH is defined.
+       For Gnulib, use attribute.h.  For glibc, use __GNUC__ >= 7.
+       Problem for glibc reported by Vaseeharan Vinayagamoorthy in:
+       https://sourceware.org/pipermail/libc-alpha/2021-January/121778.html
+       * lib/fnmatch.c (FALLTHROUGH) [_LIBC]:
+       * lib/regex_internal.h (FALLTHROUGH) [_LIBC]:
+       Don’t worry about Clang, as it’s not needed and provokes GCC.
+       * lib/fts.c (FALLTHROUGH) [!_LIBC]:
+       * lib/regex_internal.h (FALLTHROUGH) [!_LIBC]:
+       Rely on attribute.h for FALLTHROUGH
+       * modules/regex: Depend on attribute module.
+
 2021-01-19  KO Myung-Hun  <komh78@gmail.com>
 
        spawn-pipe: Fix SIGSEGV on OS/2 kLIBC.
index 5896812c966ac7c60530f5475d3c99726b6ba107..b8a71f164d80e25b1f92cf478f86d5a9c6b116b1 100644 (file)
@@ -64,7 +64,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
 #endif
 
 #ifdef _LIBC
-# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
+# if __GNUC__ >= 7
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
 # else
 #  define FALLTHROUGH ((void) 0)
index 8a9b5ed961cbb551c6d0a9f1c91150585c44c038..e6603f40e76fe86707ddf600ab7f818e3f63ccc1 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -200,8 +200,8 @@ enum Fts_stat
     while (false)
 #endif
 
-#ifndef FALLTHROUGH
-# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
+#ifdef _LIBC
+# if __GNUC__ >= 7
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
 # else
 #  define FALLTHROUGH ((void) 0)
index b4f91d9ec7158500c6d4696938e493333f623385..3fa2bf1aa574124f795bb258e2edec33b4b61c5c 100644 (file)
@@ -830,12 +830,14 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
 }
 #endif /* RE_ENABLE_I18N */
 
-#ifndef FALLTHROUGH
-# if (__GNUC__ >= 7) || (__clang_major__ >= 10)
+#ifdef _LIBC
+# if __GNUC__ >= 7
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))
 # else
 #  define FALLTHROUGH ((void) 0)
 # endif
+#else
+# include "attribute.h"
 #endif
 
 #endif /*  _REGEX_INTERNAL_H */
index 20cbe375ad67ed02fe202ba9c095861fd5e19930..a32c46e1833c58f59981badae413f636a51d06d6 100644 (file)
@@ -16,6 +16,7 @@ Depends-on:
 c99
 extensions
 ssize_t
+attribute       [test $ac_use_included_regex = yes]
 btowc           [test $ac_use_included_regex = yes]
 builtin-expect  [test $ac_use_included_regex = yes]
 dynarray        [test $ac_use_included_regex = yes]