-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Revert "sim: Specify -fshort-wchar as NuttX wchar_t is 16-bit" #4754
Conversation
compatibility with what? |
3rd party application, sorry I can't disclose the name publicly. |
From https://pubs.opengroup.org/onlinepubs/007908799/xsh/stddef.h.html:
wchar_t require to save all possible character encoding.
To cover all possible Unicode encoding, wchar_t require at least 4 bytes. So, from the standard perspective, this patch should be revert too. |
what assumption does the app make?
how about using -fshort-wchar for arm then? |
no standard mandates unicode or how it's implemented as far as i know. |
anyway, if we are going to revert this, don't forget to update this. https://github.com/apache/incubator-nuttx/blob/b58379b7380dcef3346bf9ff1ac76d40dc094095/include/sys/types.h#L170 |
It assume wchar_t is four bytes and then has the enough space to encode UCS4 encoding.
short will make it's very hard to process surrogate pair(https://en.wikipedia.org/wiki/UTF-16) as I mention in the last reply. So I don't see there is any benefit to add the seldom used flag(-fshort-wchar), could you explain why you stick with this flag? |
actually i don't insist. |
does it assume |
unicode is accepted by many countries as a standard to represent the character worldwide. If we want to support language other English, Unicode is the best option.
But if we want to support wchar_t, it's better to follow
Fix here: 339e54b
The size increasement should be small because:
|
if your app is just abusing wchar_t where it should use uint32_t, maybe this PR is enough. |
Yes, we plan to implement mbrtowc for UTF8 encoding. |
It's better to apply the default compiler option to improve the compatibility This reverts commit 3fc06ff.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
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.
lgtm
Hmm, the following commit has a problem with uSD card on Spresense.
commit 6357523
|
@xiaoxiang781216 |
Ok, we will take a look tonight. |
@xiaoxiang781216 However, there are many linker warnings.
|
i guess |
@yamt |
Summary
It's better to apply the default compiler option to improve the compatibility
This reverts commit 3fc06ff.
Here is the output from x64 gcc:
And arm gcc:
Impact
sim
Testing
pass CI and ostest