Two issues here:
- fix 2 build issue in i18n when compiling with clang++ -fsanitize=undefined
the following two symbols were not exported (and they should be):
typeinfo for icu::CollationCacheEntry
typeinfo for icu::numparse::impl::CodePointMatcher
- remove undefined behavior warning in NumberFormatTestTuple.. minor, but very annoying
when repeated many times during every test run. Tends to mask real errors.
> numberformattesttuple.cpp:319:5: runtime error: member access within null pointer of type 'NumberFormatTestTuple'
CollationTailoring(const CollationTailoring &other);
};
-struct CollationCacheEntry : public SharedObject {
+struct U_I18N_API CollationCacheEntry : public SharedObject {
CollationCacheEntry(const Locale &loc, const CollationTailoring *t)
: validLocale(loc), tailoring(t) {
if(t != NULL) {
using ::icu::number::impl::CurrencySymbols;
-class CodePointMatcher : public NumberParseMatcher, public UMemory {
+class U_I18N_API CodePointMatcher : public NumberParseMatcher, public UMemory {
public:
CodePointMatcher() = default; // WARNING: Leaves the object in an unusable state
#include "cstring.h"
#include "cmemory.h"
-static NumberFormatTestTuple *gNullPtr = NULL;
+static NumberFormatTestTuple emptyObject;
+
+static NumberFormatTestTuple *gNullPtr = &emptyObject;
#define FIELD_OFFSET(fieldName) ((int32_t) (((char *) &gNullPtr->fieldName) - ((char *) gNullPtr)))
#define FIELD_FLAG_OFFSET(fieldName) ((int32_t) (((char *) &gNullPtr->fieldName##Flag) - ((char *) gNullPtr)))