summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-02-25 15:30:42 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-02-25 15:31:05 -0800
commitd125d4f6d1a5d9845824aaf1d1c9dc69699bf2f1 (patch)
tree0a4b507e4fa343e2a43dace61b97db6ad32b11d8
parent2510ffcdcdad4e5cd20455b4891de4f5e128072a (diff)
downloadgnulib-d125d4f6d1a5d9845824aaf1d1c9dc69699bf2f1.tar.gz
Port __has_attribute to Apple’s Clang renumbering
Problem reported by Kirill A. Korinsky in: https://lists.gnu.org/r/bug-gnulib/2022-02/msg00034.html * config/srclist.txt: Comment out sys/cdefs.h for now. * lib/cdefs.h (__glibc_has_attribute): * m4/gnulib-common.m4 (gl_COMMON_BODY): Port to Apple’s renumbering of Clang versions.
-rw-r--r--ChangeLog8
-rw-r--r--config/srclist.txt2
-rw-r--r--lib/cdefs.h4
-rw-r--r--m4/gnulib-common.m44
4 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 49a1e6a168..0b8525e926 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2022-02-25 Paul Eggert <eggert@cs.ucla.edu>
+ Port __has_attribute to Apple’s Clang renumbering
+ Problem reported by Kirill A. Korinsky in:
+ https://lists.gnu.org/r/bug-gnulib/2022-02/msg00034.html
+ * config/srclist.txt: Comment out sys/cdefs.h for now.
+ * lib/cdefs.h (__glibc_has_attribute):
+ * m4/gnulib-common.m4 (gl_COMMON_BODY):
+ Port to Apple’s renumbering of Clang versions.
+
nanosleep: simplify by using pselect
GNU Emacs avoids Gnulib’s ‘select’ module and uses only pselect,
which it implements in a special way on MS-DOS.
diff --git a/config/srclist.txt b/config/srclist.txt
index dc69587e99..d89cd30ed9 100644
--- a/config/srclist.txt
+++ b/config/srclist.txt
@@ -64,7 +64,7 @@ $LIBCSRC malloc/scratch_buffer_grow.c lib/malloc
$LIBCSRC malloc/scratch_buffer_grow_preserve.c lib/malloc
$LIBCSRC malloc/scratch_buffer_set_array_size.c lib/malloc
#$LIBCSRC include/intprops.h lib
-$LIBCSRC misc/sys/cdefs.h lib
+#$LIBCSRC misc/sys/cdefs.h lib
#$LIBCSRC posix/regcomp.c lib
$LIBCSRC posix/regex.c lib
$LIBCSRC posix/regex.h lib
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 44d3826bca..cb2514504f 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -41,7 +41,9 @@
Similarly for __has_builtin, etc. */
#if (defined __has_attribute \
&& (!defined __clang_minor__ \
- || 3 < __clang_major__ + (5 <= __clang_minor__)))
+ || (defined __apple_build_version__ \
+ ? 6000000 <= __apple_build_version__ \
+ : 3 < __clang_major__ + (5 <= __clang_minor__))))
# define __glibc_has_attribute(attr) __has_attribute (attr)
#else
# define __glibc_has_attribute(attr) 0
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index dbc4079614..c5ced04f18 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -69,7 +69,9 @@ AC_DEFUN([gl_COMMON_BODY], [
[/* Attributes. */
#if (defined __has_attribute \
&& (!defined __clang_minor__ \
- || 3 < __clang_major__ + (5 <= __clang_minor__)))
+ || (defined __apple_build_version__ \
+ ? 6000000 <= __apple_build_version__ \
+ : 3 < __clang_major__ + (5 <= __clang_minor__))))
# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
#else
# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr