Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a51af08

Browse files
authored
Merge pull request #22378 from filipnavara/native_cpp_to_C
Convert System.Globalization.Native to C
2 parents bbd7905 + 772b2da commit a51af08

28 files changed

+1186
-945
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2424
set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)
2525
set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)
2626
set(GENERATED_EVENTING_DIR ${CMAKE_CURRENT_BINARY_DIR}/eventing)
27-
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp")
27+
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c")
2828
set(PAL_REDEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/dlls/mscordac/palredefines.S)
2929

3030
set(CORECLR_SET_RPATH ON)

build-test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ build_native_projects()
472472
if [ $__SkipConfigure == 0 ]; then
473473
# if msbuild is not supported, then set __SkipGenerateVersion to 1
474474
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
475-
# Drop version.cpp file
476-
__versionSourceFile="$intermediatesForBuild/version.cpp"
475+
# Drop version.c file
476+
__versionSourceFile="$intermediatesForBuild/version.c"
477477
if [ $__SkipGenerateVersion == 0 ]; then
478478
pwd
479479
$__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
@@ -484,7 +484,7 @@ build_native_projects()
484484
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
485485
$__CommonMSBuildArgs $__UnprocessedBuildArgs
486486
else
487-
# Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
487+
# Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
488488
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
489489
if [ -e $__versionSourceFile ]; then
490490
read existingVersionSourceLine < $__versionSourceFile

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ build_native()
293293
if [ $__SkipConfigure == 0 ]; then
294294
# if msbuild is not supported, then set __SkipGenerateVersion to 1
295295
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
296-
# Drop version.cpp file
297-
__versionSourceFile="$intermediatesForBuild/version.cpp"
296+
# Drop version.c file
297+
__versionSourceFile="$intermediatesForBuild/version.c"
298298
if [ $__SkipGenerateVersion == 0 ]; then
299299
pwd
300300
"$__ProjectRoot/dotnet.sh" msbuild /nologo /verbosity:minimal /clp:Summary \
@@ -304,7 +304,7 @@ build_native()
304304
"$__ProjectDir/build.proj" /p:GenerateVersionSourceFile=true /t:GenerateVersionSourceFile /p:NativeVersionSourceFile=$__versionSourceFile \
305305
$__CommonMSBuildArgs $__UnprocessedBuildArgs
306306
else
307-
# Generate the dummy version.cpp, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
307+
# Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
308308
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
309309
if [ -e $__versionSourceFile ]; then
310310
read existingVersionSourceLine < $__versionSourceFile

src/corefx/System.Globalization.Native/CMakeLists.txt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
project(System.Globalization.Native)
1+
project(System.Globalization.Native C)
32

43
set(CMAKE_INCLUDE_CURRENT_DIR ON)
54

@@ -8,6 +7,9 @@ add_definitions(-DBIT64=1)
87

98
set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
109

10+
# We mark the function which needs exporting with DLLEXPORT
11+
add_compile_options(-fvisibility=hidden)
12+
1113
find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
1214
if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
1315
message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
@@ -39,18 +41,19 @@ endif()
3941
include(configure.cmake)
4042

4143
add_compile_options(-fPIC)
44+
add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers)
4245

4346
set(NATIVEGLOBALIZATION_SOURCES
44-
calendarData.cpp
45-
casing.cpp
46-
collation.cpp
47-
idna.cpp
48-
locale.cpp
49-
localeNumberData.cpp
50-
localeStringData.cpp
51-
normalization.cpp
52-
timeZoneInfo.cpp
53-
icushim.cpp
47+
pal_calendarData.c
48+
pal_casing.c
49+
pal_collation.c
50+
pal_idna.c
51+
pal_locale.c
52+
pal_localeNumberData.c
53+
pal_localeStringData.c
54+
pal_normalization.c
55+
pal_timeZoneInfo.c
56+
pal_icushim.c
5457
)
5558

5659
include_directories(${UTYPES_H})
@@ -97,4 +100,3 @@ verify_dependencies(
97100
# add the install targets
98101
install_clr(System.Globalization.Native)
99102
install(TARGETS System.Globalization.Native_Static DESTINATION .)
100-

src/corefx/System.Globalization.Native/configure.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
include(CheckCXXSourceCompiles)
2-
include(CheckCXXSymbolExists)
1+
include(CheckCSourceCompiles)
2+
include(CheckSymbolExists)
33

44
set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
55

6-
CHECK_CXX_SOURCE_COMPILES("
6+
CHECK_C_SOURCE_COMPILES("
77
#include <unicode/udat.h>
8-
int main() { UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
8+
int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
99
" HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
1010

1111
if(NOT CLR_CMAKE_PLATFORM_DARWIN)
@@ -14,7 +14,7 @@ else()
1414
set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
1515
endif()
1616

17-
check_cxx_symbol_exists(
17+
check_symbol_exists(
1818
ucol_setMaxVariable
1919
"unicode/ucol.h"
2020
HAVE_SET_MAX_VARIABLE)

src/corefx/System.Globalization.Native/holders.h

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)