[libcxx] r274403 - Work around ABI break caused by C++17 inline variables.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 1 16:34:36 PDT 2016


On Fri, Jul 1, 2016 at 4:22 PM, Eric Fiselier via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Jul  1 18:22:25 2016
> New Revision: 274403
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274403&view=rev
> Log:
> Work around ABI break caused by C++17 inline variables.
>
> Modified:
>     libcxx/trunk/src/chrono.cpp
>
> Modified: libcxx/trunk/src/chrono.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/chrono.cpp?rev=274403&r1=274402&r2=274403&view=diff
>
> ==============================================================================
> --- libcxx/trunk/src/chrono.cpp (original)
> +++ libcxx/trunk/src/chrono.cpp Fri Jul  1 18:22:25 2016
> @@ -6,7 +6,7 @@
>  // Source Licenses. See LICENSE.TXT for details.
>  //
>
>  //===----------------------------------------------------------------------===//
> -
> +#define _LIBCPP_BUILDING_CHRONO
>  #include "chrono"
>  #include "cerrno"        // errno
>  #include "system_error"  // __throw_system_error
> @@ -32,6 +32,9 @@ namespace chrono
>  // system_clock
>
>  const bool system_clock::is_steady;
>

Can you mark this as __attribute__((used)) instead of adding a separate use?


> +// Make is_steady non-discardable in C++17
> +// See PR28395 (https://llvm.org/bugs/show_bug.cgi?id=28395)
> +static const bool& __is_steady_force_use1 __attribute__((used)) =
> system_clock::is_steady;
>
>  system_clock::time_point
>  system_clock::now() _NOEXCEPT
> @@ -68,6 +71,10 @@ system_clock::from_time_t(time_t t) _NOE
>  //  instead.
>
>  const bool steady_clock::is_steady;
> +// Make is_steady non-discardable in C++17
> +// See PR28395 (https://llvm.org/bugs/show_bug.cgi?id=28395)
> +static const bool& __is_steady_force_use2 __attribute__((used)) =
> steady_clock::is_steady;
> +
>
>  #ifdef CLOCK_MONOTONIC
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160701/50b3e2c1/attachment.html>


More information about the cfe-commits mailing list