Files
haikuports/dev-libs/icu/patches/icu-57.1.gcc2.patchset
Jerome Duval 87bc25ad5d icu: add recipe for version 57.1.
* rename the 56.1 recipe for icu56 for compatibility.
2016-07-12 13:42:00 +00:00

1140 lines
38 KiB
Plaintext

From 62fd52642dfd0e4bbdf1af17c7e0b7f9568ecb55 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sun, 19 Apr 2015 13:35:11 +0200
Subject: [PATCH 1/6] gcc2 fixes for tools, tests, layout.
---
source/layout/LETableReference.h | 4 ++++
source/test/intltest/apicoll.cpp | 15 +++++++++++++++
source/test/iotest/stream.cpp | 2 +-
source/tools/toolutil/udbgutil.cpp | 2 ++
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/source/layout/LETableReference.h b/source/layout/LETableReference.h
index ccbe65d..27233b9 100644
--- a/source/layout/LETableReference.h
+++ b/source/layout/LETableReference.h
@@ -316,7 +316,11 @@ LE_TRACE_TR("INFO: new RTAO")
le_uint32 getCount() const { return fCount; }
+#if __GNUC__ == 2
+ const T *getAlias() const { return LETableReference::getAlias(); }
+#else
using LETableReference::getAlias;
+#endif
const T *getAlias(le_uint32 i, LEErrorCode &success) const {
return ((const T*)(((const char*)getAlias())+getOffsetFor(i, success)));
diff --git a/source/test/intltest/apicoll.cpp b/source/test/intltest/apicoll.cpp
index c1e9d5b..8046c04 100644
--- a/source/test/intltest/apicoll.cpp
+++ b/source/test/intltest/apicoll.cpp
@@ -1971,7 +1971,22 @@ class TestCollator : public Collator
public:
virtual Collator* clone(void) const;
+#if __GNUC__ == 2
+ EComparisonResult compare (const UnicodeString& s1, const UnicodeString& s2)
+ const {
+ return Collator::compare(s1, s2);
+ }
+ EComparisonResult compare (const UnicodeString& s1, const UnicodeString& s2,
+ int32_t i) const {
+ return Collator::compare(s1, s2, i);
+ }
+ EComparisonResult compare (const UChar* s1, int32_t l1, const UChar* s2,
+ int32_t l2) const {
+ return Collator::compare(s1, l1, s2, l2);
+ }
+#else
using Collator::compare;
+#endif
virtual UCollationResult compare(const UnicodeString& source,
const UnicodeString& target,
diff --git a/source/test/iotest/stream.cpp b/source/test/iotest/stream.cpp
index e54e8b6..dd719c6 100644
--- a/source/test/iotest/stream.cpp
+++ b/source/test/iotest/stream.cpp
@@ -132,7 +132,7 @@ static void U_CALLCONV TestStream(void)
#endif
UnicodeString ustr("string");
- outFormatStream << "1234567890" << setw(10) << left << ustr << " " << "0123456789";
+ outFormatStream << "1234567890" << setw(10) << ios::left << ustr << " " << "0123456789";
#ifdef USE_SSTREAM
tempStr = outFormatStream.str();
diff --git a/source/tools/toolutil/udbgutil.cpp b/source/tools/toolutil/udbgutil.cpp
index 819cbd9..d3db9d1 100644
--- a/source/tools/toolutil/udbgutil.cpp
+++ b/source/tools/toolutil/udbgutil.cpp
@@ -647,7 +647,9 @@ U_CAPI void udbg_knownIssue_close(void *ptr) {
#include <set>
#include <map>
#include <string>
+#if __GNUC__ > 2
#include <ostream>
+#endif
#include <iostream>
class KnownIssues {
--
2.7.0
From 0a67a931e4f0f502d36c743aefbb005776df96f7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sun, 19 Apr 2015 13:35:47 +0200
Subject: [PATCH 2/6] gcc2 fixes for sources/i18n
---
source/i18n/alphaindex.cpp | 8 +++----
source/i18n/currfmt.h | 2 ++
source/i18n/digitlst.cpp | 6 +++++
source/i18n/digitlst.h | 2 +-
source/i18n/msgfmt.cpp | 1 +
source/i18n/reldtfmt.h | 2 ++
source/i18n/sortkey.cpp | 2 +-
source/i18n/unicode/choicfmt.h | 21 +++++++++++++++++
source/i18n/unicode/compactdecimalformat.h | 6 +++++
source/i18n/unicode/datefmt.h | 6 +++++
source/i18n/unicode/decimfmt.h | 36 ++++++++++++++++++++++++++++++
source/i18n/unicode/dtitvfmt.h | 2 ++
source/i18n/unicode/measfmt.h | 17 ++++++++++++++
source/i18n/unicode/msgfmt.h | 13 +++++++++++
source/i18n/unicode/numfmt.h | 8 +++++++
source/i18n/unicode/plurfmt.h | 7 ++++++
source/i18n/unicode/rbnf.h | 22 ++++++++++++++++++
source/i18n/unicode/selfmt.h | 4 +++-
source/i18n/unicode/smpdtfmt.h | 29 ++++++++++++++++++++++++
source/i18n/unicode/tblcoll.h | 15 +++++++++++++
source/i18n/unicode/tzfmt.h | 7 ++++++
21 files changed, 209 insertions(+), 7 deletions(-)
diff --git a/source/i18n/alphaindex.cpp b/source/i18n/alphaindex.cpp
index 9fa98b8..5535be2 100644
--- a/source/i18n/alphaindex.cpp
+++ b/source/i18n/alphaindex.cpp
@@ -952,8 +952,8 @@ static int32_t U_CALLCONV
collatorComparator(const void *context, const void *left, const void *right) {
const UElement *leftElement = static_cast<const UElement *>(left);
const UElement *rightElement = static_cast<const UElement *>(right);
- const UnicodeString *leftString = static_cast<const UnicodeString *>(leftElement->pointer);
- const UnicodeString *rightString = static_cast<const UnicodeString *>(rightElement->pointer);
+ const UnicodeString *leftString = (const UnicodeString *)(leftElement->pointer);
+ const UnicodeString *rightString = (const UnicodeString *)(rightElement->pointer);
if (leftString == rightString) {
// Catches case where both are NULL
@@ -977,8 +977,8 @@ static int32_t U_CALLCONV
recordCompareFn(const void *context, const void *left, const void *right) {
const UElement *leftElement = static_cast<const UElement *>(left);
const UElement *rightElement = static_cast<const UElement *>(right);
- const AlphabeticIndex::Record *leftRec = static_cast<const AlphabeticIndex::Record *>(leftElement->pointer);
- const AlphabeticIndex::Record *rightRec = static_cast<const AlphabeticIndex::Record *>(rightElement->pointer);
+ const AlphabeticIndex::Record *leftRec = (const AlphabeticIndex::Record *)(leftElement->pointer);
+ const AlphabeticIndex::Record *rightRec = (const AlphabeticIndex::Record *)(rightElement->pointer);
const Collator *col = static_cast<const Collator *>(context);
UErrorCode errorCode = U_ZERO_ERROR;
return col->compare(leftRec->name_, rightRec->name_, errorCode);
diff --git a/source/i18n/currfmt.h b/source/i18n/currfmt.h
index b3f23e5..1495316 100644
--- a/source/i18n/currfmt.h
+++ b/source/i18n/currfmt.h
@@ -58,7 +58,9 @@ class CurrencyFormat : public MeasureFormat {
virtual Format* clone() const;
+#if __GNUC__ > 2
using MeasureFormat::format;
+#endif
/**
* Override Format API.
diff --git a/source/i18n/digitlst.cpp b/source/i18n/digitlst.cpp
index 16b9dc3..1fd4dea 100644
--- a/source/i18n/digitlst.cpp
+++ b/source/i18n/digitlst.cpp
@@ -39,7 +39,9 @@
#include <limits.h>
#include <string.h>
#include <stdio.h>
+#if __GNUC__ > 2
#include <limits>
+#endif
// ***************************************************************************
// class DigitList
@@ -455,11 +457,15 @@ DigitList::getDouble() const
tDouble /= -1;
}
} else if (isInfinite()) {
+#if __GNUC__ <= 2
+ tDouble = DBL_MAX;
+#else
if (std::numeric_limits<double>::has_infinity) {
tDouble = std::numeric_limits<double>::infinity();
} else {
tDouble = std::numeric_limits<double>::max();
}
+#endif
if (!isPositive()) {
tDouble = -tDouble; //this was incorrectly "-fDouble" originally.
}
diff --git a/source/i18n/digitlst.h b/source/i18n/digitlst.h
index 1715e2c..c430203 100644
--- a/source/i18n/digitlst.h
+++ b/source/i18n/digitlst.h
@@ -486,7 +486,7 @@ private:
public:
-#if U_OVERRIDE_CXX_ALLOCATION
+#if U_OVERRIDE_CXX_ALLOCATION && __GNUC__ > 2
using UMemory::operator new;
using UMemory::operator delete;
#else
diff --git a/source/i18n/msgfmt.cpp b/source/i18n/msgfmt.cpp
index 1fe2c8d..66e3121 100644
--- a/source/i18n/msgfmt.cpp
+++ b/source/i18n/msgfmt.cpp
@@ -1485,6 +1485,7 @@ MessageFormat::parse(int32_t msgStart,
prevIndex=msgPattern.getPart(argLimit).getLimit();
i=argLimit;
}
+ return NULL;
}
// -------------------------------------
// Parses the source pattern and returns the Formattable objects array,
diff --git a/source/i18n/reldtfmt.h b/source/i18n/reldtfmt.h
index dcc3ca8..707b593 100644
--- a/source/i18n/reldtfmt.h
+++ b/source/i18n/reldtfmt.h
@@ -81,7 +81,9 @@ public:
virtual UBool operator==(const Format& other) const;
+#if __GNUC__ > 2
using DateFormat::format;
+#endif
/**
* Format a date or time, which is the standard millis since 24:00 GMT, Jan
diff --git a/source/i18n/sortkey.cpp b/source/i18n/sortkey.cpp
index baf3254..838ea82 100644
--- a/source/i18n/sortkey.cpp
+++ b/source/i18n/sortkey.cpp
@@ -172,7 +172,7 @@ Collator::EComparisonResult
CollationKey::compareTo(const CollationKey& target) const
{
UErrorCode errorCode = U_ZERO_ERROR;
- return static_cast<Collator::EComparisonResult>(compareTo(target, errorCode));
+ return (Collator::EComparisonResult)(compareTo(target, errorCode));
}
// Bitwise comparison for the collation keys.
diff --git a/source/i18n/unicode/choicfmt.h b/source/i18n/unicode/choicfmt.h
index cfd5206..d2b7f66 100644
--- a/source/i18n/unicode/choicfmt.h
+++ b/source/i18n/unicode/choicfmt.h
@@ -355,7 +355,22 @@ public:
virtual const UnicodeString* getFormats(int32_t& count) const;
+#if __GNUC__ == 2
+ virtual UnicodeString& format (double number,
+ icu::UnicodeString& appendTo) const {
+ return NumberFormat::format(number, appendTo);
+ }
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPosition& p, UErrorCode& e) const {
+ return NumberFormat::format(f, s, p, e);
+ }
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ UErrorCode& e) const {
+ return NumberFormat::format(f, s, e);
+ }
+#else
using NumberFormat::format;
+#endif
/**
* Formats a double number using this object's choices.
@@ -421,7 +436,13 @@ public:
FieldPosition& pos,
UErrorCode& success) const;
+#if __GNUC__ == 2
+ void parse(UnicodeString& s, Formattable& f, UErrorCode& e) const {
+ NumberFormat::parse(s, f, e);
+ }
+#else
using NumberFormat::parse;
+#endif
/**
* Looks for the longest match of any message string on the input text and,
diff --git a/source/i18n/unicode/compactdecimalformat.h b/source/i18n/unicode/compactdecimalformat.h
index ced6bee..87209fa 100644
--- a/source/i18n/unicode/compactdecimalformat.h
+++ b/source/i18n/unicode/compactdecimalformat.h
@@ -104,7 +104,13 @@ public:
virtual UBool operator==(const Format& other) const;
+#if __GNUC__ == 2
+ UnicodeString& format(double n, UnicodeString& s) const {
+ return DecimalFormat::format(n, s);
+ }
+#else
using DecimalFormat::format;
+#endif
/**
* Format a double or long number using base-10 representation.
diff --git a/source/i18n/unicode/datefmt.h b/source/i18n/unicode/datefmt.h
index e98617a..196b603 100644
--- a/source/i18n/unicode/datefmt.h
+++ b/source/i18n/unicode/datefmt.h
@@ -221,7 +221,13 @@ public:
virtual UBool operator==(const Format&) const;
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& f, UnicodeString& s, UErrorCode& e) const {
+ return Format::format(f, s, e);
+ }
+#else
using Format::format;
+#endif
/**
* Format an object to produce a string. This method handles Formattable
diff --git a/source/i18n/unicode/decimfmt.h b/source/i18n/unicode/decimfmt.h
index e7f8ea5..bcbdeca 100644
--- a/source/i18n/unicode/decimfmt.h
+++ b/source/i18n/unicode/decimfmt.h
@@ -922,7 +922,35 @@ public:
virtual UBool operator==(const Format& other) const;
+#if __GNUC__ == 2
+ virtual UnicodeString& format (double number,
+ icu::UnicodeString& appendTo) const {
+ return NumberFormat::format(number, appendTo);
+ }
+
+ virtual UnicodeString& format (double number,
+ icu::UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return NumberFormat::format(number, appendTo, status);
+ }
+
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPositionIterator* i, UErrorCode& e) const {
+ return NumberFormat::format(f, s, i, e);
+ }
+
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPosition& p, UErrorCode& e) const {
+ return NumberFormat::format(f, s, p, e);
+ }
+
+ UnicodeString& format(const Formattable& f, UnicodeString& s, UErrorCode& e)
+ const {
+ return NumberFormat::format(f, s, e);
+ }
+#else
using NumberFormat::format;
+#endif
/**
* Format a double or long number using base-10 representation.
@@ -1169,7 +1197,15 @@ public:
FieldPosition& pos,
UErrorCode& status) const;
+#if __GNUC__ == 2
+ void parse(const UnicodeString& text,
+ Formattable& result,
+ UErrorCode& status) const {
+ NumberFormat::parse(text, result, status);
+ }
+#else
using NumberFormat::parse;
+#endif
/**
* Parse the given string using this object's choices. The method
diff --git a/source/i18n/unicode/dtitvfmt.h b/source/i18n/unicode/dtitvfmt.h
index 181d46c..8996c2d 100644
--- a/source/i18n/unicode/dtitvfmt.h
+++ b/source/i18n/unicode/dtitvfmt.h
@@ -375,7 +375,9 @@ public:
UBool operator!=(const Format& other) const;
+#if __GNUC__ > 2
using Format::format;
+#endif
/**
* Format an object to produce a string. This method handles Formattable
diff --git a/source/i18n/unicode/measfmt.h b/source/i18n/unicode/measfmt.h
index 57debd9..e7d3583 100644
--- a/source/i18n/unicode/measfmt.h
+++ b/source/i18n/unicode/measfmt.h
@@ -92,8 +92,25 @@ class DateFormat;
*/
class U_I18N_API MeasureFormat : public Format {
public:
+#if __GNUC__ == 2
+ void parseObject (const UnicodeString& s, Formattable& f, UErrorCode& e)
+ const {
+ Format::parseObject(s, f, e);
+ }
+
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPositionIterator* i, UErrorCode& e) const {
+ return Format::format(f, s, i, e);
+ }
+
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ UErrorCode& e) const {
+ return Format::format(f, s, e);
+ }
+#else
using Format::parseObject;
using Format::format;
+#endif
/**
* Constructor.
diff --git a/source/i18n/unicode/msgfmt.h b/source/i18n/unicode/msgfmt.h
index 5de91e4..8f9f995 100644
--- a/source/i18n/unicode/msgfmt.h
+++ b/source/i18n/unicode/msgfmt.h
@@ -622,7 +622,17 @@ public:
virtual const Format** getFormats(int32_t& count) const;
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPositionIterator* i, UErrorCode& e) const {
+ return Format::format(f, s, i, e);
+ }
+ UnicodeString& format(const Formattable& f, UnicodeString& s, UErrorCode& e) {
+ return Format::format(f, s, e);
+ }
+#else
using Format::format;
+#endif
/**
* Formats the given array of arguments into a user-readable string.
@@ -884,6 +894,9 @@ private:
PluralRules* rules;
UPluralType type;
};
+#if __GNUC__ == 2
+ friend class PluralSelectorProvider;
+#endif
/**
* A MessageFormat formats an array of arguments. Each argument
diff --git a/source/i18n/unicode/numfmt.h b/source/i18n/unicode/numfmt.h
index 1d16131..e05d4c0 100644
--- a/source/i18n/unicode/numfmt.h
+++ b/source/i18n/unicode/numfmt.h
@@ -230,7 +230,15 @@ public:
virtual UBool operator==(const Format& other) const;
+#if __GNUC__ == 2
+ virtual UnicodeString& format (const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode & status) const {
+ return Format::format(obj, appendTo, status);
+ }
+#else
using Format::format;
+#endif
/**
* Format an object to produce a string. This method handles
diff --git a/source/i18n/unicode/plurfmt.h b/source/i18n/unicode/plurfmt.h
index f7099d8..bedaf01 100644
--- a/source/i18n/unicode/plurfmt.h
+++ b/source/i18n/unicode/plurfmt.h
@@ -313,7 +313,14 @@ public:
void applyPattern(const UnicodeString& pattern, UErrorCode& status);
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPositionIterator* i, UErrorCode& e) const {
+ return Format::format(f, s, i, e);
+ }
+#else
using Format::format;
+#endif
/**
* Formats a plural message for a given number.
diff --git a/source/i18n/unicode/rbnf.h b/source/i18n/unicode/rbnf.h
index 8d61986..daf223c 100644
--- a/source/i18n/unicode/rbnf.h
+++ b/source/i18n/unicode/rbnf.h
@@ -772,7 +772,23 @@ public:
const Locale& locale = Locale::getDefault());
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& f, UnicodeString& s, UErrorCode& e)
+ const {
+ return NumberFormat::format(f, s, e);
+ }
+
+ UnicodeString& format(double n, UnicodeString& s) const {
+ return NumberFormat::format(n, s);
+ }
+
+ UnicodeString& format(int64_t n, UnicodeString& s, FieldPosition& p,
+ UErrorCode& e) const {
+ return NumberFormat::format(n, s, p, e);
+ }
+#else
using NumberFormat::format;
+#endif
/**
* Formats the specified 32-bit number using the default ruleset.
@@ -858,7 +874,13 @@ public:
FieldPosition& pos,
UErrorCode& status) const;
+#if __GNUC__ == 2
+ void parse(const UnicodeString& s, Formattable& f, UErrorCode& e) const {
+ return NumberFormat::parse(s, f, e);
+ }
+#else
using NumberFormat::parse;
+#endif
/**
* Parses the specfied string, beginning at the specified position, according
diff --git a/source/i18n/unicode/selfmt.h b/source/i18n/unicode/selfmt.h
index 635144b..7247839 100644
--- a/source/i18n/unicode/selfmt.h
+++ b/source/i18n/unicode/selfmt.h
@@ -219,7 +219,9 @@ public:
void applyPattern(const UnicodeString& pattern, UErrorCode& status);
+#if __GNUC__ > 2
using Format::format;
+#endif
/**
* Selects the phrase for the given keyword
@@ -340,9 +342,9 @@ public:
*/
virtual UClassID getDynamicClassID() const;
-private:
friend class MessageFormat;
+private:
SelectFormat(); // default constructor not implemented.
/**
diff --git a/source/i18n/unicode/smpdtfmt.h b/source/i18n/unicode/smpdtfmt.h
index b7fa420..d17c501 100644
--- a/source/i18n/unicode/smpdtfmt.h
+++ b/source/i18n/unicode/smpdtfmt.h
@@ -870,7 +870,27 @@ public:
virtual UBool operator==(const Format& other) const;
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& f, UnicodeString& s,
+ FieldPositionIterator* i, UErrorCode& e) const {
+ return DateFormat::format(f, s, i, e);
+ }
+ UnicodeString& format(const Formattable& f, UnicodeString& s, FieldPosition& p,
+ UErrorCode& e) const {
+ return DateFormat::format(f, s, p, e);
+ }
+ UnicodeString& format(const Formattable& f, UnicodeString& s, UErrorCode& e) const {
+ return Format::format(f, s, e);
+ }
+ UnicodeString& format(const UDate& d, UnicodeString& s, FieldPosition& f) const {
+ return DateFormat::format(d, s, f);
+ }
+ UnicodeString& format(const UDate& d, UnicodeString& s) const {
+ return DateFormat::format(d, s);
+ }
+#else
using DateFormat::format;
+#endif
/**
* Format a date or time, which is the standard millis since 24:00 GMT, Jan
@@ -915,7 +935,16 @@ public:
FieldPositionIterator* posIter,
UErrorCode& status) const;
+#if __GNUC__ == 2
+ UDate parse(const UnicodeString& s, UErrorCode& e) const {
+ return DateFormat::parse(s, e);
+ }
+ UDate parse (const UnicodeString& s, ParsePosition& p) const {
+ return DateFormat::parse(s, p);
+ }
+#else
using DateFormat::parse;
+#endif
/**
* Parse a date/time string beginning at the given parse position. For
diff --git a/source/i18n/unicode/tblcoll.h b/source/i18n/unicode/tblcoll.h
index 020c4b9..a749968 100644
--- a/source/i18n/unicode/tblcoll.h
+++ b/source/i18n/unicode/tblcoll.h
@@ -254,7 +254,22 @@ public:
const CharacterIterator& source) const;
// Make deprecated versions of Collator::compare() visible.
+#if __GNUC__ == 2
+ EComparisonResult compare(const UChar* source, int sourceLength,
+ const UChar* target, int targetLength) const {
+ return Collator::compare(source, sourceLength, target, targetLength);
+ }
+ EComparisonResult compare(const UnicodeString& s1, const UnicodeString& s2,
+ int i) const {
+ return Collator::compare(s1, s2, i);
+ }
+ EComparisonResult compare(const UnicodeString& s1, const UnicodeString& s2)
+ const {
+ return Collator::compare(s1, s2);
+ }
+#else
using Collator::compare;
+#endif
/**
* The comparison function compares the character data stored in two
diff --git a/source/i18n/unicode/tzfmt.h b/source/i18n/unicode/tzfmt.h
index 5ec6c44..aee5067 100644
--- a/source/i18n/unicode/tzfmt.h
+++ b/source/i18n/unicode/tzfmt.h
@@ -517,7 +517,14 @@ public:
*/
UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const;
+#if __GNUC__ == 2
+ UnicodeString& format(const Formattable& data, UnicodeString& string,
+ FieldPositionIterator* iterator, UErrorCode& error) const {
+ return Format::format(data, string, iterator, error);
+ }
+#else
using Format::format;
+#endif
/**
* Returns the display name of the time zone at the given date for the style.
--
2.7.0
From 140f1a145e008b8a0b10d0e353063069ed2e363a Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sun, 19 Apr 2015 13:36:37 +0200
Subject: [PATCH 3/6] gcc2 fixes in source/common
---
source/common/unicode/bytestrie.h | 3 +++
source/common/unicode/bytestriebuilder.h | 3 +++
source/common/unicode/platform.h | 2 +-
source/common/unicode/stringtriebuilder.h | 9 +++++++++
source/common/unicode/ucharstrie.h | 3 +++
source/common/unicode/ucharstriebuilder.h | 3 +++
6 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/source/common/unicode/bytestrie.h b/source/common/unicode/bytestrie.h
index 9c77827..367a0ae 100644
--- a/source/common/unicode/bytestrie.h
+++ b/source/common/unicode/bytestrie.h
@@ -338,6 +338,9 @@ public:
// but the code looks more confusing that way.)
UVector32 *stack_;
};
+#if __GNUC__ == 2
+ friend class Iterator;
+#endif
private:
friend class BytesTrieBuilder;
diff --git a/source/common/unicode/bytestriebuilder.h b/source/common/unicode/bytestriebuilder.h
index e7fbd6b..001233f 100644
--- a/source/common/unicode/bytestriebuilder.h
+++ b/source/common/unicode/bytestriebuilder.h
@@ -153,6 +153,9 @@ private:
private:
const char *s;
};
+#if __GNUC__ == 2
+ friend class BTLinearMatchNode;
+#endif
// don't use #ifndef U_HIDE_INTERNAL_API with private class members or virtual methods.
virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length,
diff --git a/source/common/unicode/platform.h b/source/common/unicode/platform.h
index 1320bd3..3c385c1 100644
--- a/source/common/unicode/platform.h
+++ b/source/common/unicode/platform.h
@@ -801,7 +801,7 @@
/* Use the predefined value. */
#elif defined(U_STATIC_IMPLEMENTATION)
# define U_EXPORT
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && __GNUC__ > 2
# define U_EXPORT __attribute__((visibility("default")))
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
diff --git a/source/common/unicode/stringtriebuilder.h b/source/common/unicode/stringtriebuilder.h
index 04447e5..21bab82 100644
--- a/source/common/unicode/stringtriebuilder.h
+++ b/source/common/unicode/stringtriebuilder.h
@@ -379,6 +379,15 @@ protected:
int32_t length;
Node *next; // A branch sub-node.
};
+#if __GNUC__ >= 2
+ friend class FinalValueNode;
+ friend class ValueNode;
+ friend class IntermediateValueNode;
+ friend class BranchNode;
+ friend class ListBranchNode;
+ friend class SplitBranchNode;
+ friend class BranchHeadNode;
+#endif
#endif /* U_HIDE_INTERNAL_API */
/** @internal */
diff --git a/source/common/unicode/ucharstrie.h b/source/common/unicode/ucharstrie.h
index 0575a97..9fe81c1 100644
--- a/source/common/unicode/ucharstrie.h
+++ b/source/common/unicode/ucharstrie.h
@@ -356,6 +356,9 @@ public:
// but the code looks more confusing that way.)
UVector32 *stack_;
};
+#if __GNUC__ == 2
+ friend class Iterator;
+#endif
private:
friend class UCharsTrieBuilder;
diff --git a/source/common/unicode/ucharstriebuilder.h b/source/common/unicode/ucharstriebuilder.h
index f7a8039..8b136d6 100644
--- a/source/common/unicode/ucharstriebuilder.h
+++ b/source/common/unicode/ucharstriebuilder.h
@@ -156,6 +156,9 @@ private:
private:
const UChar *s;
};
+#if __GNUC__ == 2
+ friend class UCTLinearMatchNode;
+#endif
virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
Node *nextNode) const;
--
2.7.0
From 977dcd090b434c1ca15740f30caf8e9d05bbea5a Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Mon, 6 Oct 2014 13:28:09 +0200
Subject: [PATCH 4/6] more gcc2 fixes for ICU 54.
---
source/common/filteredbrk.cpp | 6 ++++++
source/common/norm2allmodes.h | 12 ++++++++++++
source/common/putilimp.h | 2 +-
source/common/unicode/platform.h | 2 +-
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/source/common/filteredbrk.cpp b/source/common/filteredbrk.cpp
index 5a8f0b0..e141654 100644
--- a/source/common/filteredbrk.cpp
+++ b/source/common/filteredbrk.cpp
@@ -68,7 +68,13 @@ class U_COMMON_API UStringSet : public UVector {
inline UBool contains(const UnicodeString& s) {
return contains((void*) &s);
}
+#if __GNUC__ == 2
+ UBool contains(void* s) {
+ return UVector::contains(s);
+ }
+#else
using UVector::contains;
+#endif
/**
* Return the ith UnicodeString alias
*/
diff --git a/source/common/norm2allmodes.h b/source/common/norm2allmodes.h
index 64c84a2..aca1e08 100644
--- a/source/common/norm2allmodes.h
+++ b/source/common/norm2allmodes.h
@@ -193,7 +193,9 @@ private:
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
impl.decompose(src, limit, &buffer, errorCode);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
+#endif
virtual void
normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
UnicodeString &safeMiddle,
@@ -204,7 +206,9 @@ private:
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const {
return impl.decompose(src, limit, NULL, errorCode);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
+#endif
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const {
return impl.isDecompYes(impl.getNorm16(c)) ? UNORM_YES : UNORM_NO;
}
@@ -225,7 +229,9 @@ private:
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
impl.compose(src, limit, onlyContiguous, TRUE, buffer, errorCode);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
+#endif
virtual void
normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
UnicodeString &safeMiddle,
@@ -268,7 +274,9 @@ private:
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const {
return impl.composeQuickCheck(src, limit, onlyContiguous, NULL);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
+#endif
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const {
return impl.getCompQuickCheck(impl.getNorm16(c));
}
@@ -296,7 +304,9 @@ private:
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
impl.makeFCD(src, limit, &buffer, errorCode);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
+#endif
virtual void
normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
UnicodeString &safeMiddle,
@@ -307,7 +317,9 @@ private:
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const {
return impl.makeFCD(src, limit, NULL, errorCode);
}
+#if __GNUC__ != 2
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
+#endif
virtual UBool hasBoundaryBefore(UChar32 c) const { return impl.hasFCDBoundaryBefore(c); }
virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasFCDBoundaryAfter(c); }
virtual UBool isInert(UChar32 c) const { return impl.isFCDInert(c); }
diff --git a/source/common/putilimp.h b/source/common/putilimp.h
index c7b33ee..4891eed 100644
--- a/source/common/putilimp.h
+++ b/source/common/putilimp.h
@@ -113,7 +113,7 @@ typedef size_t uintptr_t;
#if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE)
/* Use the predefined value. */
-#elif U_PLATFORM == U_PF_ANDROID
+#elif U_PLATFORM == U_PF_ANDROID || defined(__HAIKU__)
# define U_TIMEZONE timezone
#elif U_PLATFORM_IS_LINUX_BASED
# if defined(__UCLIBC__)
diff --git a/source/common/unicode/platform.h b/source/common/unicode/platform.h
index 3c385c1..b0cd48a 100644
--- a/source/common/unicode/platform.h
+++ b/source/common/unicode/platform.h
@@ -159,7 +159,7 @@
# else
# define U_PLATFORM U_PF_DARWIN
# endif
-#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
+#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__) || defined(__HAIKU__)
# if defined(__FreeBSD__)
# include <sys/endian.h>
# endif
--
2.7.0
From 1bea021df8dd7b340b8e9bac1ca4beea40d642cc Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 26 Mar 2015 18:39:42 +0000
Subject: [PATCH 5/6] gcc2 fixes for tztools.
---
source/tools/tzcode/private.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/tools/tzcode/private.h b/source/tools/tzcode/private.h
index 1a85c88..0ee3329 100644
--- a/source/tools/tzcode/private.h
+++ b/source/tools/tzcode/private.h
@@ -120,7 +120,7 @@
*/
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H \
- (199901 <= __STDC_VERSION__ || \
+ (defined(__HAIKU__) || 199901 <= __STDC_VERSION__ || \
2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
#endif /* !defined HAVE_STDINT_H */
--
2.7.0
From a04e19e395f20ad567f8467ac0783e25e2b37c11 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 11 Jan 2016 21:56:11 +0000
Subject: [PATCH 6/6] gcc2 fixes for icu 56.
---
source/tools/genrb/reslist.cpp | 6 +++---
source/tools/genrb/reslist.h | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/source/tools/genrb/reslist.cpp b/source/tools/genrb/reslist.cpp
index 9f8365d..7158961 100644
--- a/source/tools/genrb/reslist.cpp
+++ b/source/tools/genrb/reslist.cpp
@@ -303,14 +303,14 @@ StringBaseResource::~StringBaseResource() {}
static int32_t U_CALLCONV
string_hash(const UElement key) {
- const StringResource *res = static_cast<const StringResource *>(key.pointer);
+ const StringResource *res = reinterpret_cast<const StringResource *>(key.pointer);
return res->fString.hashCode();
}
static UBool U_CALLCONV
string_comp(const UElement key1, const UElement key2) {
- const StringResource *res1 = static_cast<const StringResource *>(key1.pointer);
- const StringResource *res2 = static_cast<const StringResource *>(key2.pointer);
+ const StringResource *res1 = reinterpret_cast<const StringResource *>(key1.pointer);
+ const StringResource *res2 = reinterpret_cast<const StringResource *>(key2.pointer);
return res1->fString == res2->fString;
}
diff --git a/source/tools/genrb/reslist.h b/source/tools/genrb/reslist.h
index 032c0c2..1017b91 100644
--- a/source/tools/genrb/reslist.h
+++ b/source/tools/genrb/reslist.h
@@ -65,7 +65,7 @@ typedef struct KeyMapEntry {
} KeyMapEntry;
/* Resource bundle root table */
-struct SRBRoot {
+typedef struct SRBRoot {
SRBRoot(const UString *comment, UBool isPoolBundle, UErrorCode &errorCode);
~SRBRoot();
@@ -113,8 +113,8 @@ public:
int32_t fPoolStringIndexLimit;
int32_t fPoolStringIndex16Limit;
int32_t fLocalStringIndexLimit;
- SRBRoot *fWritePoolBundle;
-};
+ struct SRBRoot *fWritePoolBundle;
+} SRBRoot;
/* write a java resource file */
// TODO: C++ify
@@ -217,7 +217,7 @@ struct SResource {
int32_t fKey; /* Index into bundle->fKeys; -1 if no key. */
int32_t fKey16; /* Key16 version of fKey for Table & Table16; -1 if no key or it does not fit. */
int line; /* used internally to report duplicate keys in tables */
- SResource *fNext; /* This is for internal chaining while building */
+ struct SResource *fNext; /* This is for internal chaining while building */
struct UString fComment;
};
@@ -344,7 +344,7 @@ public:
void writeUTF16v2(int32_t base, icu::UnicodeString &dest);
- StringResource *fSame; // used for duplicates
+ class StringResource *fSame; // used for duplicates
int32_t fSuffixOffset; // this string is a suffix of fSame at this offset
int32_t fNumCopies; // number of equal strings represented by one stringSet element
int32_t fNumUnitsSaved; // from not writing duplicates and suffixes
--
2.7.0
From e5747c5e89e2a3703daa81b2c085ce2f90639584 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 11 Jul 2016 21:32:25 +0000
Subject: [PATCH] gcc2 fix for i18n 57.1
---
source/i18n/dayperiodrules.h | 12 ++++++++++++
source/i18n/dtptngen.cpp | 3 ++-
source/i18n/smpdtfmt.cpp | 3 ++-
source/i18n/unicode/dtitvinf.h | 23 +++++++++++++++++++++--
4 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/source/i18n/dayperiodrules.h b/source/i18n/dayperiodrules.h
index 5491f7c..a3d641a 100644
--- a/source/i18n/dayperiodrules.h
+++ b/source/i18n/dayperiodrules.h
@@ -56,17 +56,29 @@ public:
private:
DayPeriodRules();
+#if __GNUC__ == 2
+public:
+#endif
// Translates "morning1" to DAYPERIOD_MORNING1, for example.
static DayPeriod getDayPeriodFromString(const char *type_str);
+#if __GNUC__ == 2
+private:
+#endif
static void load(UErrorCode &errorCode);
// Sets period type for all hours in [startHour, limitHour).
void add(int32_t startHour, int32_t limitHour, DayPeriod period);
+#if __GNUC__ == 2
+public:
+#endif
// Returns TRUE if for all i, DayPeriodForHour[i] has a type other than UNKNOWN.
// Values of HasNoon and HasMidnight do not affect the return value.
UBool allHoursAreSet();
+#if __GNUC__ == 2
+private:
+#endif
// Returns the hour that starts dayPeriod. Returns 0 for MIDNIGHT and 12 for NOON.
int32_t getStartHourForDayPeriod(DayPeriod dayPeriod, UErrorCode &errorCode) const;
diff --git a/source/i18n/dtptngen.cpp b/source/i18n/dtptngen.cpp
index 2a6b35b..beb6a5c 100644
--- a/source/i18n/dtptngen.cpp
+++ b/source/i18n/dtptngen.cpp
@@ -1420,7 +1420,8 @@ DateTimePatternGenerator::getBestAppending(int32_t missingFields, int32_t flags,
&tempPattern,
&appendName
};
- SimpleFormatter(appendItemFormats[topField], 2, 3, err).
+ UnicodeString tempus = appendItemFormats[topField];
+ SimpleFormatter(tempus, 2, 3, err).
formatAndReplace(values, 3, resultPattern, NULL, 0, err);
lastMissingFieldMask = distanceInfo->missingFieldMask;
}
diff --git a/source/i18n/smpdtfmt.cpp b/source/i18n/smpdtfmt.cpp
index 145587f..b8793e0 100644
--- a/source/i18n/smpdtfmt.cpp
+++ b/source/i18n/smpdtfmt.cpp
@@ -796,7 +796,8 @@ void SimpleDateFormat::construct(EStyle timeStyle,
}
resStr = ures_getStringByIndex(dateTimePatterns, glueIndex, &resStrLen, &status);
- SimpleFormatter(UnicodeString(TRUE, resStr, resStrLen), 2, 2, status).
+ UnicodeString tempus3(TRUE, resStr, resStrLen);
+ SimpleFormatter(tempus3, 2, 2, status).
format(tempus1, tempus2, fPattern, status);
}
// if the pattern includes just time data or just date date, load the appropriate
diff --git a/source/i18n/unicode/dtitvinf.h b/source/i18n/unicode/dtitvinf.h
index 2b23dfe..09a4908 100644
--- a/source/i18n/unicode/dtitvinf.h
+++ b/source/i18n/unicode/dtitvinf.h
@@ -327,8 +327,11 @@ public:
*/
static UClassID U_EXPORT2 getStaticClassID();
-
+#if __GNUC__ == 2
+public:
+#else
private:
+#endif
/**
* DateIntervalFormat will need access to
* getBestSkeleton(), parseSkeleton(), enum IntervalPatternIndex,
@@ -340,7 +343,7 @@ private:
friend class DateIntervalFormat;
friend struct DateIntervalSink;
-
+
/**
* Following is for saving the interval patterns.
* We only support interval patterns on
@@ -378,6 +381,9 @@ private:
*/
void initializeData(const Locale& locale, UErrorCode& status);
+#if __GNUC__ == 2
+public:
+#endif
/* Set Interval pattern.
*
@@ -416,6 +422,9 @@ private:
const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
int8_t& bestMatchDistanceInfo) const;
+#if __GNUC__ == 2
+private:
+#endif
/**
* Parse skeleton, save each field's width.
@@ -443,6 +452,9 @@ private:
int32_t anotherFieldWidth,
char patternLetter);
+#if __GNUC__ == 2
+public:
+#endif
/**
* Convert calendar field to the interval pattern index in
@@ -460,6 +472,9 @@ private:
static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
UCalendarDateFields field,
UErrorCode& status);
+#if __GNUC__ == 2
+private:
+#endif
/**
@@ -496,6 +511,10 @@ private:
// default order
UBool fFirstDateInPtnIsLaterDate;
+#if __GNUC__ == 2
+public:
+#endif
+
// HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
// HashMap( skeleton, pattern[largest_different_field] )
Hashtable* fIntervalPatterns;
--
2.7.0