[Boost-bugs] [Boost C++ Libraries] #6940: TIME_UTC is a macro in C11

Subject: [Boost-bugs] [Boost C++ Libraries] #6940: TIME_UTC is a macro in C11
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-24 18:43:50


#6940: TIME_UTC is a macro in C11
---------------------------------+------------------------------------------
 Reporter: pmachata@… | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
---------------------------------+------------------------------------------
 Excerpt from the C11 standard draft that I have at hand:

 {{{
 7.27 Date and time <time.h>
 The macros defined are [...] TIME_UTC which expands to an integer constant
 greater than 0 that designates the UTC time base.
 }}}

 glibc implements this in development version, though the latest release
 (2.15) doesn't yet include this code. The Linux distribution Fedora
 rawhide (what is to become Fedora 18) now includes this code as well.

 This collides with the following code in boost/thread/xtime.hpp, which
 thus becomes invalid, as it includes <ctime> via
 <boost/thread/thread_time.hpp>.
 {{{
 enum xtime_clock_types
 {
     TIME_UTC=1
 [...]
 }}}

 Unfortunately, on Linux, this is a problem in any C++ code. g++
 implicitly defines _GNU_SOURCE, which in turn causes _ISOC11_SOURCE to be
 defined, regardless of what C++ standard is actually used. But regardless
 of this gcc feature, the boost interfaces are broken if I want to use C11
 interfaces from C++ code.

 I couldn't find any recent documentation on this interface. It doesn't
 seem to be used much, and some old documentation (1.34) states that it
 will be obsoleted at some point. What would be used instead?

 Just dropping that enum would probably work in case of Fedora in
 particular, and that's what I'm going to do for boost package in Fedora.
 The type itself is never used. Users of the sole enum value would have to
 be changed from boost::TIME_UTC to mere TIME_UTC (taken from glibc), as
 the two happen to have the same value. That would be about it. But
 that's clearly not acceptable as an upstream solution.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6940>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC