]> 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>
Fri, 21 Apr 2023 01:51:48 +0000 (03:51 +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 011626b96d7a659359948429f2de950e56f13595..0751af3fa5945d52341f65b3fce62f9b6ab1660e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-04-19  Bruno Haible  <bruno@clisp.org>
+
+       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.
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 50c9b30b6b35c78c54b6ad17fcb5aae199140a6a..8207cdf64cc794cf26eac56d14892da3f9081fea 100644 (file)
@@ -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));