From 57d2a227e2ef996dd493822ab5ad54f3e712a3b1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 20 Apr 2023 02:18:59 +0200 Subject: ctime: Fix compilation errors in C++ mode on mingw 10. * lib/c++defs.h (_GL_FUNCDECL_RPL): Add a comment. * lib/time.in.h (ctime): Don't use _GL_ATTRIBUTE_DEPRECATED before _GL_FUNCDECL_RPL in C++ mode. --- ChangeLog | 9 ++++++++- lib/c++defs.h | 6 ++++++ lib/time.in.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4266437e42..fbc1812489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ 2023-04-19 Bruno Haible - random: Fix compilation errors in C++ on mingw 10. + ctime: Fix compilation errors in C++ mode on mingw 10. + * lib/c++defs.h (_GL_FUNCDECL_RPL): Add a comment. + * lib/time.in.h (ctime): Don't use _GL_ATTRIBUTE_DEPRECATED before + _GL_FUNCDECL_RPL in C++ mode. + +2023-04-19 Bruno Haible + + random: Fix compilation errors in C++ mode on mingw 10. * lib/stdlib.in.h (random, srandom): Disable _GL_CXXALIASWARN invocation on non-glibc systems. diff --git a/lib/c++defs.h b/lib/c++defs.h index 8ad46951ad..458c014de5 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -99,6 +99,12 @@ Example: _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1))); + + Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front + of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's + because + [[...]] extern "C" ; + is invalid syntax in C++.) */ #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) diff --git a/lib/time.in.h b/lib/time.in.h index 84cb1fa933..06428adb1d 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -356,7 +356,9 @@ _GL_CXXALIASWARN (strptime); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define ctime rpl_ctime # endif +# ifndef __cplusplus _GL_ATTRIBUTE_DEPRECATED +# endif _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); -- cgit v1.2.1