bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

time: Fix compilation error in C++ mode on Solaris 11


From: Bruno Haible
Subject: time: Fix compilation error in C++ mode on Solaris 11
Date: Sat, 08 Apr 2023 09:56:56 +0200

On Solaris 11.4, Solaris OpenIndiana, and Solaris OmniOS, I'm seeing this
compilation error:

In file included from /usr/include/sys/select.h:27:0,
                 from ../gllib/sys/select.h:36,
                 from /usr/include/sys/types.h:665,
                 from ../gllib/sys/types.h:39,
                 from /usr/include/time.h:16,
                 from ../gllib/time.h:47,
                 from ../../gltests/test-time-h-c++.cc:22:
../gllib/time.h:664:1: error: 'std::time_t time(std::time_t*)' conflicts with a 
previous declaration
 _GL_CXXALIASWARN (time);
 ^
In file included from /usr/include/time.h:12:0,
                 from ../gllib/time.h:47,
                 from ../../gltests/test-time-h-c++.cc:22:
/usr/include/iso/time_iso.h:96:15: note: previous declaration 'std::time_t 
std::time(std::time_t*)'
 extern time_t time(time_t *);
               ^~~~
gmake[4]: *** [Makefile:24119: test-time-h-c++.o] Error 1

This patch fixes it.


2023-04-08  Bruno Haible  <bruno@clisp.org>

        time: Fix compilation error in C++ mode on Solaris 11.
        * lib/time.in.h (time): Disable _GL_CXXALIASWARN invocation on non-glibc
        systems.

diff --git a/lib/time.in.h b/lib/time.in.h
index 3f9af920e3..f9b517a3dd 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -154,7 +154,9 @@ _GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
 #  else
 _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
 #  endif
+#  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (time);
+#  endif
 # endif
 
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,






reply via email to

[Prev in Thread] Current Thread [Next in Thread]