From 1a1bb292ab53c0c30d35dc396c7089c1da5b3c82 Mon Sep 17 00:00:00 2001 From: Sinan Kaya <41809318+franksinankaya@users.noreply.github.com> Date: Wed, 20 Feb 2019 11:59:22 -0500 Subject: Abstract deprecated and selectany for GCC and remove LLVM'ism where possible (#22662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Abstract selectany * Fix initializer element is not constant src/corefx/System.Globalization.Native/pal_icushim.c:58:34: error: initializer element is not constant static const int MaxICUVersion = MinICUVersion + 20; * Enable ms extensions * Apply LLVM patterns to GCC * Remove deprecated function * Fix const conversion error src/corefx/System.Globalization.Native/pal_calendarData.c:390:16: warning: passing argument 1 of ‘ures_close_ptr’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] ures_close(erasResBundle); src/corefx/System.Globalization.Native/pal_calendarData.c:419:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] char* name = GetCalendarName(calendarId); * Remove old compiler option --- src/corefx/System.Globalization.Native/CMakeLists.txt | 1 - src/corefx/System.Globalization.Native/pal_calendarData.c | 12 ++++++------ src/corefx/System.Globalization.Native/pal_icushim.c | 12 ++++++------ 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src/corefx') diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index 5e38c6bd12..3d2518d45b 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -38,7 +38,6 @@ endif() include(configure.cmake) add_compile_options(-fPIC) -add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers) set(NATIVEGLOBALIZATION_SOURCES pal_calendarData.c diff --git a/src/corefx/System.Globalization.Native/pal_calendarData.c b/src/corefx/System.Globalization.Native/pal_calendarData.c index be0cc9b6b8..07f8a6f290 100644 --- a/src/corefx/System.Globalization.Native/pal_calendarData.c +++ b/src/corefx/System.Globalization.Native/pal_calendarData.c @@ -377,11 +377,11 @@ static void EnumUResourceBundle(const UResourceBundle* bundle, } } -static void CloseResBundle(const UResourceBundle* rootResBundle, - const UResourceBundle* calResBundle, - const UResourceBundle* targetCalResBundle, - const UResourceBundle* erasColResBundle, - const UResourceBundle* erasResBundle) +static void CloseResBundle(UResourceBundle* rootResBundle, + UResourceBundle* calResBundle, + UResourceBundle* targetCalResBundle, + UResourceBundle* erasColResBundle, + UResourceBundle* erasResBundle) { ures_close(rootResBundle); ures_close(calResBundle); @@ -416,7 +416,7 @@ static int32_t EnumAbbrevEraNames(const char* locale, while (TRUE) { UErrorCode status = U_ZERO_ERROR; - char* name = GetCalendarName(calendarId); + const char* name = GetCalendarName(calendarId); UResourceBundle* rootResBundle = ures_open(NULL, localeNamePtr, &status); UResourceBundle* calResBundle = ures_getByKey(rootResBundle, "calendar", NULL, &status); diff --git a/src/corefx/System.Globalization.Native/pal_icushim.c b/src/corefx/System.Globalization.Native/pal_icushim.c index ce42af642f..04f73759cd 100644 --- a/src/corefx/System.Globalization.Native/pal_icushim.c +++ b/src/corefx/System.Globalization.Native/pal_icushim.c @@ -54,12 +54,12 @@ static int FindICULibs(const char* versionPrefix, char* symbolName, char* symbol // equal to the version we are built against and less or equal to that version // plus 20 to give us enough headspace. The ICU seems to version about twice // a year. -static const int MinICUVersion = U_ICU_VERSION_MAJOR_NUM; -static const int MaxICUVersion = MinICUVersion + 20; -static const int MinMinorICUVersion = 1; -static const int MaxMinorICUVersion = 5; -static const int MinSubICUVersion = 1; -static const int MaxSubICUVersion = 5; +#define MinICUVersion U_ICU_VERSION_MAJOR_NUM +#define MaxICUVersion (MinICUVersion + 20) +#define MinMinorICUVersion 1 +#define MaxMinorICUVersion 5 +#define MinSubICUVersion 1 +#define MaxSubICUVersion 5 // Get filename of an ICU library with the requested version in the name // There are three possible cases of the version components values: -- cgit v1.2.3