Skip to content

Commit 5e7bead

Browse files
committed
Update from Gnulib
This incorporates: 2020-02-08 lchmod: ensure declaration on HP-UX 2020-02-08 fchmodat: fix endless recursion on Cygwin 2020-02-08 Fix compilation errors in a testdir 2020-02-07 fchmodat: AT_SYMLINK_NOFOLLOW fix for non-symlinks 2020-02-04 Port _Noreturn to older Clang 2020-02-03 libc-config: port to Apple’s Clang variant * lib/_Noreturn.h, lib/c++defs.h, lib/libc-config.h, lib/sys_stat.in.h: * m4/gnulib-common.m4, m4/sys_stat_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
1 parent 2645ae1 commit 5e7bead

File tree

7 files changed

+50
-27
lines changed

7 files changed

+50
-27
lines changed

lib/_Noreturn.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
# define _Noreturn [[noreturn]]
2929
# elif ((!defined __cplusplus || defined __clang__) \
3030
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
31-
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
31+
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
32+
|| (defined __apple_build_version__ \
33+
? 6000000 <= __apple_build_version__ \
34+
: 3 < __clang_major__ + (5 <= __clang_minor__))))
3235
/* _Noreturn works as-is. */
3336
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
3437
# define _Noreturn __attribute__ ((__noreturn__))

lib/c++defs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@
301301
_GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
302302
"The symbol ::" #func " refers to the system function. " \
303303
"Use " #namespace "::" #func " instead.")
304-
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
305-
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
306-
extern __typeof__ (func) func
307304
# else
308305
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
309306
_GL_EXTERN_C int _gl_cxxalias_dummy

lib/gnulib.mk.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ REPLACE_DPRINTF = @REPLACE_DPRINTF@
854854
REPLACE_DUP = @REPLACE_DUP@
855855
REPLACE_DUP2 = @REPLACE_DUP2@
856856
REPLACE_FACCESSAT = @REPLACE_FACCESSAT@
857+
REPLACE_FCHMODAT = @REPLACE_FCHMODAT@
857858
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
858859
REPLACE_FCLOSE = @REPLACE_FCLOSE@
859860
REPLACE_FCNTL = @REPLACE_FCNTL@
@@ -885,6 +886,7 @@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
885886
REPLACE_GMTIME = @REPLACE_GMTIME@
886887
REPLACE_INITSTATE = @REPLACE_INITSTATE@
887888
REPLACE_ISATTY = @REPLACE_ISATTY@
889+
REPLACE_LCHMOD = @REPLACE_LCHMOD@
888890
REPLACE_LCHOWN = @REPLACE_LCHOWN@
889891
REPLACE_LINK = @REPLACE_LINK@
890892
REPLACE_LINKAT = @REPLACE_LINKAT@
@@ -2935,9 +2937,11 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
29352937
-e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
29362938
-e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
29372939
-e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
2940+
-e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \
29382941
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
29392942
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
29402943
-e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \
2944+
-e 's|@''REPLACE_LCHMOD''@|$(REPLACE_LCHMOD)|g' \
29412945
-e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
29422946
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
29432947
-e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \

lib/libc-config.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,17 @@
5555

5656
#ifndef __glibc_clang_prereq
5757
# if defined __clang_major__ && defined __clang_minor__
58-
# define __glibc_clang_prereq(maj, min) \
59-
((maj) < __clang_major__ + ((min) <= __clang_minor__))
58+
# ifdef __apple_build_version__
59+
/* Apple for some reason renumbers __clang_major__ and __clang_minor__.
60+
Gnulib code uses only __glibc_clang_prereq (3, 5); map it to
61+
6000000 <= __apple_build_version__. Support for other calls to
62+
__glibc_clang_prereq can be added here as needed. */
63+
# define __glibc_clang_prereq(maj, min) \
64+
((maj) == 3 && (min) == 5 ? 6000000 <= __apple_build_version__ : 0)
65+
# else
66+
# define __glibc_clang_prereq(maj, min) \
67+
((maj) < __clang_major__ + ((min) <= __clang_minor__))
68+
# endif
6069
# else
6170
# define __glibc_clang_prereq(maj, min) 0
6271
# endif

lib/sys_stat.in.h

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,25 @@ struct stat
392392

393393

394394
#if @GNULIB_FCHMODAT@
395-
# if !@HAVE_FCHMODAT@
395+
# if @REPLACE_FCHMODAT@
396+
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
397+
# undef fchmodat
398+
# define fchmodat rpl_fchmodat
399+
# endif
400+
_GL_FUNCDECL_RPL (fchmodat, int,
401+
(int fd, char const *file, mode_t mode, int flag)
402+
_GL_ARG_NONNULL ((2)));
403+
_GL_CXXALIAS_RPL (fchmodat, int,
404+
(int fd, char const *file, mode_t mode, int flag));
405+
# else
406+
# if !@HAVE_FCHMODAT@
396407
_GL_FUNCDECL_SYS (fchmodat, int,
397408
(int fd, char const *file, mode_t mode, int flag)
398409
_GL_ARG_NONNULL ((2)));
399-
# endif
410+
# endif
400411
_GL_CXXALIAS_SYS (fchmodat, int,
401412
(int fd, char const *file, mode_t mode, int flag));
413+
# endif
402414
_GL_CXXALIASWARN (fchmodat);
403415
#elif defined GNULIB_POSIXCHECK
404416
# undef fchmodat
@@ -502,31 +514,24 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
502514
#if @GNULIB_LCHMOD@
503515
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
504516
denotes a symbolic link. */
505-
# if !@HAVE_LCHMOD@
506-
/* The lchmod replacement follows symbolic links. Callers should take
507-
this into account; lchmod should be applied only to arguments that
508-
are known to not be symbolic links. On hosts that lack lchmod,
509-
this can lead to race conditions between the check and the
510-
invocation of lchmod, but we know of no workarounds that are
511-
reliable in general. You might try requesting support for lchmod
512-
from your operating system supplier. */
517+
# if @REPLACE_LCHMOD@
513518
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514-
# define lchmod chmod
519+
# undef lchmod
520+
# define lchmod rpl_lchmod
515521
# endif
516-
/* Need to cast, because on mingw, the second parameter of chmod is
517-
int mode. */
518-
_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
519-
(const char *filename, mode_t mode));
522+
_GL_FUNCDECL_RPL (lchmod, int,
523+
(char const *filename, mode_t mode)
524+
_GL_ARG_NONNULL ((1)));
525+
_GL_CXXALIAS_RPL (lchmod, int,
526+
(char const *filename, mode_t mode));
520527
# else
521-
# if 0 /* assume already declared */
528+
# if !@HAVE_LCHMOD@ || defined __hpux
522529
_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
523530
_GL_ARG_NONNULL ((1)));
524531
# endif
525532
_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
526533
# endif
527-
# if @HAVE_LCHMOD@
528534
_GL_CXXALIASWARN (lchmod);
529-
# endif
530535
#elif defined GNULIB_POSIXCHECK
531536
# undef lchmod
532537
# if HAVE_RAW_DECL_LCHMOD

m4/gnulib-common.m4

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gnulib-common.m4 serial 47
1+
# gnulib-common.m4 serial 48
22
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
33
dnl This file is free software; the Free Software Foundation
44
dnl gives unlimited permission to copy and/or distribute it,
@@ -31,7 +31,10 @@ AC_DEFUN([gl_COMMON_BODY], [
3131
# define _Noreturn [[noreturn]]
3232
# elif ((!defined __cplusplus || defined __clang__) \
3333
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
34-
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
34+
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
35+
|| (defined __apple_build_version__ \
36+
? 6000000 <= __apple_build_version__ \
37+
: 3 < __clang_major__ + (5 <= __clang_minor__))))
3538
/* _Noreturn works as-is. */
3639
# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
3740
# define _Noreturn __attribute__ ((__noreturn__))

m4/sys_stat_h.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# sys_stat_h.m4 serial 31 -*- Autoconf -*-
1+
# sys_stat_h.m4 serial 32 -*- Autoconf -*-
22
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
33
dnl This file is free software; the Free Software Foundation
44
dnl gives unlimited permission to copy and/or distribute it,
@@ -88,9 +88,11 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
8888
HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
8989
HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
9090
HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
91+
REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT])
9192
REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
9293
REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
9394
REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
95+
REPLACE_LCHMOD=0; AC_SUBST([REPLACE_LCHMOD])
9496
REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
9597
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
9698
REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])

0 commit comments

Comments
 (0)