-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add System.Globalization.Native support for Windows #33704
Conversation
src/libraries/Native/AnyOS/System.Globalization.Native/CMakeLists.txt
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/configure.cmake
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_icushim.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_locale.h
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_calendarData.h
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_calendarData.h
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_collation.c
Outdated
Show resolved
Hide resolved
@@ -403,8 +407,12 @@ static const UCollator* GetCollatorFromSortHandle(SortHandle* pSortHandle, int32 | |||
pCollator = CloneCollatorWithOptions(pSortHandle->collatorsPerOption[0], options, pErr); | |||
UCollator* pNull = NULL; | |||
|
|||
#ifdef TARGET_UNIX | |||
// we are not using the standard atomic_compare_exchange_strong to workaround bugs in clang 5.0 (https://bugs.llvm.org/show_bug.cgi?id=37457) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this workaround? I believe we are not building with clang5 anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. We now use clang9 so we can remove this workaround. I will fix it as part of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I try to use atomic_compare_exchange_strong
I get an error:
/home/runtime/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c:410:46: error: _Atomic cannot be applied to incomplete type 'UCollator' (aka 'struct UCollator')
if (!atomic_compare_exchange_strong((_Atomic(UCollator) *)&pSortHandle->collatorsPerOption[options], &pNull, pCollator))
/usr/include/unicode/ucol.h:58:8: note: forward declaration of 'struct UCollator'
struct UCollator;
It seems like the declaration of UCollator in the icu headers is incomplete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you need to ensure
#include "unicode/uloc.h"
is included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was included. I managed to do it with void* volatile*
. I'll put an update soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like in gcc atomic_compare_exchange_strong
uses __atomic_compare_exchange
macro which expects other parameter types, if I instead directly use __atomic_compare_exchange_n
in gcc builds just fine. Will leave as is in order to have a green build at the moment.
/__w/1/s/src/libraries/Native/Unix/Common/pal_atomic.h:15:12: error: size mismatch in argument 2 of '__atomic_compare_exchange'
return atomic_compare_exchange_strong_explicit((_Atomic(void*)volatile*)dest, exchange, comperand, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
src/libraries/Native/AnyOS/System.Globalization.Native/pal_collation.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_icushim.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_icushim_internal.h
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_icushim.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_idna.c
Outdated
Show resolved
Hide resolved
CC @janvorli |
modulo the comments mentioned here, LGTM |
src/libraries/Native/AnyOS/System.Globalization.Native/pal_collation.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_idna.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_icushim_internal.h
Outdated
Show resolved
Hide resolved
src/libraries/Native/AnyOS/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
fe6c335
to
ebe31fa
Compare
ebe31fa
to
f2e22b4
Compare
src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c
Outdated
Show resolved
Hide resolved
058e160
to
cd46ed9
Compare
cd46ed9
to
7544939
Compare
It seems like finally CI is almost green. Can I get another review on this please? 😄 |
@@ -4,7 +4,10 @@ | |||
// | |||
|
|||
#include <stdint.h> | |||
|
|||
#if defined(TARGET_UNIX) | |||
#include <unistd.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this header actually needed on Unix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. I’ll double check and if not I’ll remove it.
It seems like the failures are: #32377 — I’ve also seen them fail in some recent PRs. |
This enables building System.Globalization.Native on Windows (just building it on coreclr) since we shouldn't care about the windows native shim being built on the libraries side until the managed code is changed. I hope that by that time we have it linked in mono as well so that we can entirely stop building the shim in libraries at all.
This also enables loading icu.dll on Windows.
Contributes to: #826
cc: @jkotas @tarekgh