summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-20 02:18:59 +0200
committerBruno Haible <bruno@clisp.org>2023-04-20 02:18:59 +0200
commit57d2a227e2ef996dd493822ab5ad54f3e712a3b1 (patch)
treeb4f4462740779e6de059e544fa897eb42f17ff7c
parent5ec5eb70b1e41b7e6aca67f6531ec20d28401bd3 (diff)
downloadgnulib-57d2a227e2ef996dd493822ab5ad54f3e712a3b1.tar.gz
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.
-rw-r--r--ChangeLog9
-rw-r--r--lib/c++defs.h6
-rw-r--r--lib/time.in.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4266437e42..fbc1812489 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
2023-04-19 Bruno Haible <bruno@clisp.org>
- 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 <bruno@clisp.org>
+
+ 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" <declaration>;
+ 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));