Remove a static initializer in region.cpp
region.cpp has an unnecessary static initializer for a type
UnicodeString and triggers a 'si check' failure.
Upstream bug: http://bugs.icu-project.org/trac/ticket/12408
BUG=575007
TEST=`tools/linux/dump-static-initializers.py chrome` (static build) does not have an entry from region.cpp
TEST=`tools/linux/dump-static-initializers.py libicui18n.so` (shared build) has no entry.
TBR=thakis@chromium.org
Review URL: https://codereview.chromium.org/1816843002 .
diff --git a/README.chromium b/README.chromium
index 6b147d4..539d6e8 100644
--- a/README.chromium
+++ b/README.chromium
@@ -283,7 +283,7 @@
7. Fix 'bad cast' found in Transliterator with a cfi build
- patches/xlit_badcast.patch
- - upstream bug (yet to be resolved)
+ - upstream bug (fixed in the upstream. Will be in 57 release)
http://bugs.icu-project.org/trac/ticket/11937
8. Add back UTF-32 converters temporarily even when
@@ -301,6 +301,10 @@
10. Fix a bug in regex compiler.
- patches/regexcmp.patch
- - upstream bug
+ - upstream bug (fixed in the upstream. Will be in 57 release)
http://bugs.icu-project.org/trac/ticket/12138
+11. Remove an unnecessary static initializer
+ - patches/remove_si.patch
+ - upstream bug
+ http://bugs.icu-project.org/trac/ticket/12408
diff --git a/patches/remove_si.patch b/patches/remove_si.patch
new file mode 100644
index 0000000..93179a2
--- /dev/null
+++ b/patches/remove_si.patch
@@ -0,0 +1,69 @@
+diff --git a/patches/remove_si.patch b/patches/remove_si.patch
+index d21d996..e69de29 100644
+--- a/patches/remove_si.patch
++++ b/patches/remove_si.patch
+@@ -1,32 +0,0 @@
+-diff --git a/source/i18n/region.cpp b/source/i18n/region.cpp
+-index 085f704..b5a1ae2 100644
+---- a/source/i18n/region.cpp
+-+++ b/source/i18n/region.cpp
+-@@ -67,8 +67,7 @@ static UVector *allRegions = NULL;
+- static const UChar UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 }; /* "ZZ" */
+- static const UChar OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 }; /* "QO" */
+- static const UChar WORLD_ID [] = { 0x30, 0x30, 0x31, 0 }; /* "001" */
+--static const UChar RANGE_MARKER [] = { 0x7e, 0 }; /* "~" */
+--static const UnicodeString RANGE_MARKER_STRING(RANGE_MARKER);
+-+static const UChar RANGE_MARKER 0x7eu; /* '~' */
+-
+- UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration)
+-
+-@@ -121,7 +120,7 @@ void Region::loadRegionData(UErrorCode &status) {
+-
+- while ( ures_hasNext(regionRegular.getAlias()) ) {
+- UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status);
+-- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
+-+ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
+- UChar buf[6];
+- regionName.extract(buf,6,status);
+- if ( rangeMarkerLocation > 0 ) {
+-@@ -140,7 +139,7 @@ void Region::loadRegionData(UErrorCode &status) {
+-
+- while ( ures_hasNext(regionMacro.getAlias()) ) {
+- UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status);
+-- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
+-+ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
+- UChar buf[6];
+- regionName.extract(buf,6,status);
+- if ( rangeMarkerLocation > 0 ) {
+diff --git a/source/i18n/region.cpp b/source/i18n/region.cpp
+index 085f704..15c5dd0 100644
+--- a/source/i18n/region.cpp
++++ b/source/i18n/region.cpp
+@@ -67,8 +67,7 @@ static UVector *allRegions = NULL;
+ static const UChar UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 }; /* "ZZ" */
+ static const UChar OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 }; /* "QO" */
+ static const UChar WORLD_ID [] = { 0x30, 0x30, 0x31, 0 }; /* "001" */
+-static const UChar RANGE_MARKER [] = { 0x7e, 0 }; /* "~" */
+-static const UnicodeString RANGE_MARKER_STRING(RANGE_MARKER);
++static const UChar RANGE_MARKER = 0x7eu; /* '~' */
+
+ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration)
+
+@@ -121,7 +120,7 @@ void Region::loadRegionData(UErrorCode &status) {
+
+ while ( ures_hasNext(regionRegular.getAlias()) ) {
+ UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status);
+- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
++ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
+ UChar buf[6];
+ regionName.extract(buf,6,status);
+ if ( rangeMarkerLocation > 0 ) {
+@@ -140,7 +139,7 @@ void Region::loadRegionData(UErrorCode &status) {
+
+ while ( ures_hasNext(regionMacro.getAlias()) ) {
+ UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status);
+- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
++ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
+ UChar buf[6];
+ regionName.extract(buf,6,status);
+ if ( rangeMarkerLocation > 0 ) {
diff --git a/source/i18n/region.cpp b/source/i18n/region.cpp
index 085f704..15c5dd0 100644
--- a/source/i18n/region.cpp
+++ b/source/i18n/region.cpp
@@ -67,8 +67,7 @@
static const UChar UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 }; /* "ZZ" */
static const UChar OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 }; /* "QO" */
static const UChar WORLD_ID [] = { 0x30, 0x30, 0x31, 0 }; /* "001" */
-static const UChar RANGE_MARKER [] = { 0x7e, 0 }; /* "~" */
-static const UnicodeString RANGE_MARKER_STRING(RANGE_MARKER);
+static const UChar RANGE_MARKER = 0x7eu; /* '~' */
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration)
@@ -121,7 +120,7 @@
while ( ures_hasNext(regionRegular.getAlias()) ) {
UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status);
- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
+ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
UChar buf[6];
regionName.extract(buf,6,status);
if ( rangeMarkerLocation > 0 ) {
@@ -140,7 +139,7 @@
while ( ures_hasNext(regionMacro.getAlias()) ) {
UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status);
- int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER_STRING);
+ int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
UChar buf[6];
regionName.extract(buf,6,status);
if ( rangeMarkerLocation > 0 ) {