From 13a2e2215f733622133f98accbb8ea1445c56a66 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 20 Apr 2023 02:18:59 +0200 Subject: [PATCH] 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 | 7 +++++++ lib/c++defs.h | 6 ++++++ lib/time.in.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 011626b96d..0751af3fa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-04-19 Bruno Haible + + 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. 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 50c9b30b6b..8207cdf64c 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -315,7 +315,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)); -- 2.39.5