]> Savannah Git Hosting - gnulib.git/commitdiff
ctime: Fix compilation errors in C++ mode on mingw 10.
authorBruno Haible <bruno@clisp.org>
Thu, 20 Apr 2023 00:18:59 +0000 (02:18 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 20 Apr 2023 00:18:59 +0000 (02:18 +0200)
* 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
lib/c++defs.h
lib/time.in.h

index 4266437e42e51fc8b39d966a1d3954d72eac1d4e..fbc18124895916072e29a5d56407f56d38b64e9e 100644 (file)
--- 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.
 
index 8ad46951ad495e562a644db90527c2b572e6d8d0..458c014de5cecfcb22fd4c2b0220a596679cd2f2 100644 (file)
    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)
index 84cb1fa9338b9a943e4ac7ab1f4589e111975018..06428adb1d07dc354eca30a4a92eea78740b9eb4 100644 (file)
@@ -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));