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.
This commit is contained in:
Jeff Genovy 2018-10-19 16:19:24 -07:00
parent b8d2d92d36
commit 5a34bfb151
3 changed files with 20 additions and 5 deletions

View file

@ -54,15 +54,23 @@ U_NAMESPACE_END
#include <atomic>
U_NAMESPACE_BEGIN
// Export an explicit template instantiation of std::atomic<int32_t>.
// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class.
// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
#if defined(__clang__)
// Suppress the warning that the explicit instantiation after explicit specialization has no effect.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winstantiation-after-specialization"
#endif
template struct U_COMMON_API std::atomic<int32_t>;
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#endif
U_NAMESPACE_BEGIN
typedef std::atomic<int32_t> u_atomic_int32_t;
#define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val)

View file

@ -185,8 +185,14 @@ class NumberRangeFormatterImpl;
* Export an explicit template instantiation. See datefmt.h
* (When building DLLs for Windows this is required.)
*/
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM < U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
template struct U_I18N_API std::atomic<impl::NumberRangeFormatterImpl*>;
#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN)
} // namespace icu::number
U_NAMESPACE_END
template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
U_NAMESPACE_BEGIN
namespace number { // icu::number
#endif
/** \endcond */

View file

@ -10,6 +10,7 @@
#include "intltest.h"
#include "number_affixutils.h"
#include "numparse_stringsegment.h"
#include "numrange_impl.h"
#include "unicode/locid.h"
#include "unicode/numberformatter.h"
#include "unicode/numberrangeformatter.h"