From: Collin Funk Date: Sat, 10 May 2025 23:07:57 +0000 (-0700) Subject: fts: Fix redefinition of __THROW. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cfd636f65174efdecfe01b864878c1502b21640;p=thirdparty%2Fgnulib.git fts: Fix redefinition of __THROW. * lib/fts_.h: Include if the system has it. (__THROW, __BEGIN_DECLS, __END_DECLS): Define properly if not previously defined. * m4/fts.m4 (gl_FUNC_FTS_CORE): Check for sys/cdefs.h. --- diff --git a/ChangeLog b/ChangeLog index 2d7696a717..6c248f533a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-05-10 Collin Funk + + fts: Fix redefinition of __THROW. + * lib/fts_.h: Include if the system has it. + (__THROW, __BEGIN_DECLS, __END_DECLS): Define properly if not previously + defined. + * m4/fts.m4 (gl_FUNC_FTS_CORE): Check for sys/cdefs.h. + 2025-05-10 Bruno Haible string-desc, xstring-desc: Avoid GCC attributes in function definitions. diff --git a/lib/fts_.h b/lib/fts_.h index 9fb4c62df9..052858da7b 100644 --- a/lib/fts_.h +++ b/lib/fts_.h @@ -62,17 +62,34 @@ # define __FLEXIBLE_ARRAY_MEMBER # endif # else +# if HAVE_SYS_CDEFS_H +# include +# endif # define __FLEXIBLE_ARRAY_MEMBER FLEXIBLE_ARRAY_MEMBER -# undef __THROW -# define __THROW -# undef __BEGIN_DECLS -# undef __END_DECLS -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -# else -# define __BEGIN_DECLS -# define __END_DECLS +# ifndef __THROW +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) +# if __cplusplus >= 201103L +# define __THROW noexcept (true) +# else +# define __THROW throw () +# endif +# else +# define __THROW +# endif +# endif +# ifndef __BEGIN_DECLS +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS /* nothing */ +# endif +# endif +# ifndef __END_DECLS +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS /* nothing */ +# endif # endif # endif diff --git a/m4/fts.m4 b/m4/fts.m4 index 1c230bb93f..1d3a32f52e 100644 --- a/m4/fts.m4 +++ b/m4/fts.m4 @@ -1,5 +1,5 @@ # fts.m4 -# serial 24 +# serial 25 dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_FTS_CORE], [ dnl Prerequisites of lib/fts.c. gl_FUNC_OPENAT + AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) AC_CHECK_FUNCS_ONCE([fstatfs]) AC_CHECK_HEADERS_ONCE([sys/param.h sys/vfs.h])dnl