[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] C++: "#define timeval rpl_timeval" -> typedef in GNULIB_NAME
From: |
Bruno Haible |
Subject: |
Re: [PATCH] C++: "#define timeval rpl_timeval" -> typedef in GNULIB_NAMESPACE |
Date: |
Sat, 06 May 2017 00:19:25 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; ) |
Pedro Alves wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00058.html>:
> With GNULIB_NAMESPACE, we can do better: Make gnulib define
> GNULIB_NAMESPACE::timeval as a typedef to whatever "struct timeval" is
> (which is either the system's timeval or gnulib's rpl_timeval
> replacement), and #undef away the "#define timeval rpl_timeval".
>
> With this, you now write:
>
> gnulib::timeval tv;
> gnulib::gettimeofday (&tv, NULL);
>
> Instead of:
>
> struct timeval tv;
> gnulib::gettimeofday (&tv, NULL);
>
> And now "struct timeval" refers to the system's timeval struct. (That
> GDB wrapper for sys/time.h can then be removed, as having no effect.)
However, we (now? still?) have a compilation error on Mac OS X of the
signature tests of a C++ testdir:
$ ./gnulib-tool --create-testdir --dir=/tmp/testdir-posix --with-tests
--with-c++-tests --single-configure `./posix-modules`
Namely:
In file included from test-fcntl-h-c++.cc:22:
In file included from ../gllib/fcntl.h:67:
In file included from ../gllib/unistd.h:40:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:638:
../gllib/sys/select.h:728:27: error: elaborated type refers to a typedef
struct timeval *restrict));
^
../gllib/sys/time.h:568:5: note: declared here
timeval;
^
In file included from test-stdlib-c++.cc:22:
In file included from ../gllib/stdlib.h:96:
In file included from ../gllib/unistd.h:40:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:638:
../gllib/sys/select.h:728:27: error: elaborated type refers to a typedef
struct timeval *restrict));
^
../gllib/sys/time.h:568:5: note: declared here
timeval;
^
In file included from test-sys_ioctl-c++.cc:22:
In file included from ../gllib/sys/ioctl.h:37:
In file included from ../gllib/unistd.h:40:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:638:
../gllib/sys/select.h:728:27: error: elaborated type refers to a typedef
struct timeval *restrict));
^
../gllib/sys/time.h:568:5: note: declared here
timeval;
^
In file included from test-sys_select-c++.cc:22:
../gllib/sys/select.h:728:27: error: elaborated type refers to a typedef
struct timeval *restrict));
^
../gllib/sys/time.h:568:5: note: declared here
timeval;
^
In file included from test-unistd-c++.cc:22:
In file included from ../gllib/unistd.h:40:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/unistd.h:638:
../gllib/sys/select.h:728:27: error: elaborated type refers to a typedef
struct timeval *restrict));
^
../gllib/sys/time.h:568:5: note: declared here
timeval;
^
Any ideas how to fix this?
Bruno
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] C++: "#define timeval rpl_timeval" -> typedef in GNULIB_NAMESPACE,
Bruno Haible <=