Skip to content

Commit 5a34bfb

Browse files
committed
ICU-20209 Fix build failures on Windows with std::atomic not in enclosing namespace std
Also: Change to use the ICU namespace macro instead, and skip doxygen as well.
1 parent b8d2d92 commit 5a34bfb

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

icu4c/source/common/umutex.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,23 @@ U_NAMESPACE_END
5454

5555
#include <atomic>
5656

57-
U_NAMESPACE_BEGIN
58-
5957
// Export an explicit template instantiation of std::atomic<int32_t>.
6058
// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class.
6159
// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
62-
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
60+
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
61+
#if defined(__clang__)
62+
// Suppress the warning that the explicit instantiation after explicit specialization has no effect.
63+
#pragma clang diagnostic push
64+
#pragma clang diagnostic ignored "-Winstantiation-after-specialization"
65+
#endif
6366
template struct U_COMMON_API std::atomic<int32_t>;
67+
#if defined(__clang__)
68+
#pragma clang diagnostic pop
69+
#endif
6470
#endif
6571

72+
U_NAMESPACE_BEGIN
73+
6674
typedef std::atomic<int32_t> u_atomic_int32_t;
6775
#define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val)
6876

icu4c/source/i18n/unicode/numberrangeformatter.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,14 @@ class NumberRangeFormatterImpl;
185185
* Export an explicit template instantiation. See datefmt.h
186186
* (When building DLLs for Windows this is required.)
187187
*/
188-
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM < U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
189-
template struct U_I18N_API std::atomic<impl::NumberRangeFormatterImpl*>;
188+
#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN)
189+
} // namespace icu::number
190+
U_NAMESPACE_END
191+
192+
template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
193+
194+
U_NAMESPACE_BEGIN
195+
namespace number { // icu::number
190196
#endif
191197
/** \endcond */
192198

icu4c/source/test/intltest/numbertest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "intltest.h"
1111
#include "number_affixutils.h"
1212
#include "numparse_stringsegment.h"
13+
#include "numrange_impl.h"
1314
#include "unicode/locid.h"
1415
#include "unicode/numberformatter.h"
1516
#include "unicode/numberrangeformatter.h"

0 commit comments

Comments
 (0)