ICU-13775 Fix build issues on MinGW and Clang-for-Windows (with exported template instantiations).

X-SVN-Rev: 41460
This commit is contained in:
Jeff Genovy 2018-05-25 07:27:56 +00:00
parent bf977d1acc
commit 87122b9084
4 changed files with 39 additions and 38 deletions

View File

@ -18,7 +18,18 @@
#include "decNumber.h"
#include "charstr.h"
U_NAMESPACE_BEGIN namespace number {
U_NAMESPACE_BEGIN
#define DECNUM_INITIAL_CAPACITY 34
// Export an explicit template instantiation of the MaybeStackHeaderAndArray that is used as a data member of DecNum.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackHeaderAndArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackHeaderAndArray<decNumber, char, DECNUM_INITIAL_CAPACITY>;
#endif
namespace number {
namespace impl {
struct MicroProps : public MicroPropsGenerator {
@ -192,15 +203,6 @@ getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle st
} // namespace utils
#define DECNUM_INITIAL_CAPACITY 34
// Export an explicit template instantiation of the MaybeStackHeaderAndArray that is used as a data member of DecNum.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackHeaderAndArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackHeaderAndArray<decNumber, char, DECNUM_INITIAL_CAPACITY>;
#endif
/** A very thin C++ wrapper around decNumber.h */
// Exported as U_I18N_API for tests
class U_I18N_API DecNum : public UMemory {

View File

@ -15,7 +15,8 @@
#include <array>
U_NAMESPACE_BEGIN namespace numparse {
U_NAMESPACE_BEGIN
namespace numparse {
namespace impl {
// Forward-declaration of implementation classes for friending
@ -44,13 +45,6 @@ class CodePointMatcher : public NumberParseMatcher, public UMemory {
};
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of CodePointMatcherWarehouse.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See numparse_compositions.h, digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<CodePointMatcher*, 3>;
#endif
/**
* A warehouse to retain ownership of CodePointMatchers.
*/
@ -163,14 +157,6 @@ class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCo
void addMatcher(NumberParseMatcher& matcher) override;
};
// Export an explicit template instantiation of the CompactUnicodeString that is used as a data member of AffixPatternMatcher.
// Also an explicit template instantiation of the MaybeStackArray that is used inside of the CompactUnicodeString.
// When building DLLs for Windows this is required even though no direct access to the CompactUnicodeString leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<UChar, 4>;
template class U_I18N_API CompactUnicodeString<4>;
#endif
// Exported as U_I18N_API for tests
class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher {
@ -248,6 +234,16 @@ class AffixMatcherWarehouse {
} // namespace impl
} // namespace numparse
// Export a explicit template instantiations of MaybeStackArray and CompactUnicodeString.
// When building DLLs for Windows this is required even though no direct access leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<UChar, 4>;
template class U_I18N_API MaybeStackArray<numparse::impl::CodePointMatcher*, 3>;
template class U_I18N_API numparse::impl::CompactUnicodeString<4>;
#endif
U_NAMESPACE_END
#endif //__NUMPARSE_AFFIXES_H__

View File

@ -9,9 +9,17 @@
#include "numparse_types.h"
U_NAMESPACE_BEGIN namespace numparse {
namespace impl {
U_NAMESPACE_BEGIN
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of ArraySeriesMatcher.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 3>;
#endif
namespace numparse {
namespace impl {
/**
* Base class for AnyMatcher and SeriesMatcher.
@ -78,13 +86,6 @@ class U_I18N_API SeriesMatcher : public CompositionMatcher {
SeriesMatcher() = default;
};
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of ArraySeriesMatcher.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<const NumberParseMatcher*, 3>;
#endif
/**
* An implementation of SeriesMatcher that references an array of matchers.
*

View File

@ -19,16 +19,18 @@
#include "numparse_validators.h"
#include "number_multiplier.h"
U_NAMESPACE_BEGIN namespace numparse {
namespace impl {
U_NAMESPACE_BEGIN
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of NumberParserImpl.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See numparse_compositions.h, numparse_affixes.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<const NumberParseMatcher*, 10>;
template class U_I18N_API MaybeStackArray<const numparse::impl::NumberParseMatcher*, 10>;
#endif
namespace numparse {
namespace impl {
// Exported as U_I18N_API for tests
class U_I18N_API NumberParserImpl : public MutableMatcherCollection {
public: