ICU-20819 Correct placement of parentheses in preprocessor macro.

The purpose of the FIELD_NAME_STR() macro is to create a string literal
by using the # preprocessing operator and then skip the first 5 chars of
this string by using the +5 pointer arithmetic. This is all intentional,
but if the parentheses are misplaced the compiler might think that this
is a mistake, a failed string concatenation (-Wstring-plus-int).
This commit is contained in:
Fredrik Roubert 2019-09-18 20:26:03 +02:00 committed by Steven R. Loomis
parent 791980cf41
commit e5529933b2

View file

@ -354,7 +354,7 @@ void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
UnicodeString CalendarTest::fieldName(UCalendarDateFields f) {
switch (f) {
#define FIELD_NAME_STR(x) case x: return (#x+5)
#define FIELD_NAME_STR(x) case x: return (#x)+5
FIELD_NAME_STR( UCAL_ERA );
FIELD_NAME_STR( UCAL_YEAR );
FIELD_NAME_STR( UCAL_MONTH );