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

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 1 16:22:26 PDT 2016


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;
+// 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
 




More information about the cfe-commits mailing list