From e86394634c8acfa7b95d1016e7ce1e5cae33207b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 25 Feb 2022 15:30:42 -0800 Subject: [PATCH] =?UTF-8?q?Port=20=5F=5Fhas=5Fattribute=20to=20Apple?= =?UTF-8?q?=E2=80=99s=20Clang=20renumbering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- ChangeLog | 8 ++++++++ config/srclist.txt | 2 +- lib/cdefs.h | 4 +++- m4/gnulib-common.m4 | 4 +++- 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 + 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 -- 2.35.1