Skip to content

Commit

Permalink
Cherry-pick: ICU-21461 uprops.h: remove unused gc macros (#73)
Browse files Browse the repository at this point in the history
This change cherry-picks the upstream fix to remove macros that use
names which are reserved by the C++ standard.

There are upcoming changes to the MSVC STL headers which might use some
of these reserved names, which causes conflicts.

Upstream PR:
unicode-org/icu#1555
Upstream ticket:
https://unicode-org.atlassian.net/browse/ICU-21461
  • Loading branch information
jefgen committed Mar 5, 2021
1 parent 1c7a6e9 commit ad85227
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 70 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ ICU-21492 Fix regex compile assertion failure.
- https://unicode-org.atlassian.net/browse/ICU-21492
- https://github.com/unicode-org/icu/pull/1577

ICU-21461 uprops.h: remove unused gc macros
- https://unicode-org.atlassian.net/browse/ICU-21461
- https://github.com/unicode-org/icu/pull/1555

## ICU 68.2.0.2
#### Changes cherry-picked from upstream tickets/PRs:

Expand Down
38 changes: 20 additions & 18 deletions icu/icu4c/source/common/uchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ u_isISOControl(UChar32 c) {

/* Some control characters that are used as space. */
#define IS_THAT_CONTROL_SPACE(c) \
(c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==NL))
(c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==0x85))

/* Java has decided that U+0085 New Line is not whitespace any more. */
#define IS_THAT_ASCII_CONTROL_SPACE(c) \
Expand Down Expand Up @@ -677,14 +677,14 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
sa->add(sa->set, CR+1); /* range TAB..CR */
sa->add(sa->set, 0x1c);
sa->add(sa->set, 0x1f+1);
USET_ADD_CP_AND_NEXT(sa, NL);
USET_ADD_CP_AND_NEXT(sa, 0x85); // NEXT LINE (NEL)

/* add for u_isIDIgnorable() what was not added above */
sa->add(sa->set, DEL); /* range DEL..NBSP-1, NBSP added below */
sa->add(sa->set, 0x7f); /* range DEL..NBSP-1, NBSP added below */
sa->add(sa->set, HAIRSP);
sa->add(sa->set, RLM+1);
sa->add(sa->set, INHSWAP);
sa->add(sa->set, NOMDIG+1);
sa->add(sa->set, 0x206a); // INHIBIT SYMMETRIC SWAPPING
sa->add(sa->set, 0x206f+1); // NOMINAL DIGIT SHAPES
USET_ADD_CP_AND_NEXT(sa, ZWNBSP);

/* add no-break spaces for u_isWhitespace() what was not added above */
Expand All @@ -693,23 +693,25 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
USET_ADD_CP_AND_NEXT(sa, NNBSP);

/* add for u_digit() */
sa->add(sa->set, U_a);
sa->add(sa->set, U_z+1);
sa->add(sa->set, U_A);
sa->add(sa->set, U_Z+1);
sa->add(sa->set, U_FW_a);
sa->add(sa->set, U_FW_z+1);
sa->add(sa->set, U_FW_A);
sa->add(sa->set, U_FW_Z+1);
sa->add(sa->set, u'a');
sa->add(sa->set, u'z'+1);
sa->add(sa->set, u'A');
sa->add(sa->set, u'Z'+1);
// fullwidth
sa->add(sa->set, u'');
sa->add(sa->set, u''+1);
sa->add(sa->set, u'');
sa->add(sa->set, u''+1);

/* add for u_isxdigit() */
sa->add(sa->set, U_f+1);
sa->add(sa->set, U_F+1);
sa->add(sa->set, U_FW_f+1);
sa->add(sa->set, U_FW_F+1);
sa->add(sa->set, u'f'+1);
sa->add(sa->set, u'F'+1);
// fullwidth
sa->add(sa->set, u''+1);
sa->add(sa->set, u''+1);

/* add for UCHAR_DEFAULT_IGNORABLE_CODE_POINT what was not added above */
sa->add(sa->set, WJ); /* range WJ..NOMDIG */
sa->add(sa->set, 0x2060); /* range 2060..206f */
sa->add(sa->set, 0xfff0);
sa->add(sa->set, 0xfffb+1);
sa->add(sa->set, 0xe0000);
Expand Down
52 changes: 0 additions & 52 deletions icu/icu4c/source/common/uprops.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,55 +310,12 @@ u_isgraphPOSIX(UChar32 c);
U_CFUNC UBool
u_isprintPOSIX(UChar32 c);

/** Turn a bit index into a bit flag. @internal */
#define FLAG(n) ((uint32_t)1<<(n))

/** Flags for general categories in the order of UCharCategory. @internal */
#define _Cn FLAG(U_GENERAL_OTHER_TYPES)
#define _Lu FLAG(U_UPPERCASE_LETTER)
#define _Ll FLAG(U_LOWERCASE_LETTER)
#define _Lt FLAG(U_TITLECASE_LETTER)
#define _Lm FLAG(U_MODIFIER_LETTER)
/* #define _Lo FLAG(U_OTHER_LETTER) -- conflicts with MS Visual Studio 9.0 xiosbase */
#define _Mn FLAG(U_NON_SPACING_MARK)
#define _Me FLAG(U_ENCLOSING_MARK)
#define _Mc FLAG(U_COMBINING_SPACING_MARK)
#define _Nd FLAG(U_DECIMAL_DIGIT_NUMBER)
#define _Nl FLAG(U_LETTER_NUMBER)
#define _No FLAG(U_OTHER_NUMBER)
#define _Zs FLAG(U_SPACE_SEPARATOR)
#define _Zl FLAG(U_LINE_SEPARATOR)
#define _Zp FLAG(U_PARAGRAPH_SEPARATOR)
#define _Cc FLAG(U_CONTROL_CHAR)
#define _Cf FLAG(U_FORMAT_CHAR)
#define _Co FLAG(U_PRIVATE_USE_CHAR)
#define _Cs FLAG(U_SURROGATE)
#define _Pd FLAG(U_DASH_PUNCTUATION)
#define _Ps FLAG(U_START_PUNCTUATION)
/* #define _Pe FLAG(U_END_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 xlocnum */
/* #define _Pc FLAG(U_CONNECTOR_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */
#define _Po FLAG(U_OTHER_PUNCTUATION)
#define _Sm FLAG(U_MATH_SYMBOL)
#define _Sc FLAG(U_CURRENCY_SYMBOL)
#define _Sk FLAG(U_MODIFIER_SYMBOL)
#define _So FLAG(U_OTHER_SYMBOL)
#define _Pi FLAG(U_INITIAL_PUNCTUATION)
/* #define _Pf FLAG(U_FINAL_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */

/** Some code points. @internal */
enum {
TAB =0x0009,
LF =0x000a,
FF =0x000c,
CR =0x000d,
U_A =0x0041,
U_F =0x0046,
U_Z =0x005a,
U_a =0x0061,
U_f =0x0066,
U_z =0x007a,
DEL =0x007f,
NL =0x0085,
NBSP =0x00a0,
CGJ =0x034f,
FIGURESP=0x2007,
Expand All @@ -367,15 +324,6 @@ enum {
ZWJ =0x200d,
RLM =0x200f,
NNBSP =0x202f,
WJ =0x2060,
INHSWAP =0x206a,
NOMDIG =0x206f,
U_FW_A =0xff21,
U_FW_F =0xff26,
U_FW_Z =0xff3a,
U_FW_a =0xff41,
U_FW_f =0xff46,
U_FW_z =0xff5a,
ZWNBSP =0xfeff
};

Expand Down

0 comments on commit ad85227

Please sign in to comment.