Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Missing definition for __STDC_ISO_10646__ #44583

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR45613
Status NEW
Importance P enhancement
Reported by Joe Nelson (joe@begriffs.com)
Reported on 2020-04-19 19:06:48 -0700
Last modified on 2020-04-19 19:17:34 -0700
Version unspecified
Hardware All All
CC blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, hstong@ca.ibm.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The C99 standard says that the environment should define symbol
__STDC_ISO_10646__ when wchar_t can hold all Unicode codepoints. The specific
language is:

Section 6.10.8, Predefined macro names:
> __STDC_ISO_10646__
> An integer constant of the form yyyymmL (for example, 199712L).
> If this symbol is defined, then every character in the Unicode
> required set, when stored in an object of type wchar_t, has the
> same value as the short identifier of that character. The
> Unicode required set consists of all the characters that are
> defined by ISO/IEC 10646, along with all amendments and
> technical corrigenda, as of the specified year and month.

Clang on macOS and OpenBSD does not define this symbol, while clang on Ubuntu
does.

I created a test program at https://github.com/begriffs/wchar-conformance which
sends UTF-8 encodings of all codepoints through mbstowcs() and checks whether
the wchar_t* holds the expected values. On all three platforms (macOS, OpenBSD,
Ubuntu) the test program was successful. Unless I misunderstood the standard,
clang on macOS and OpenBSD should define the symbol, but they haven't.

Version specifics:

----------------------------------------------------
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
----------------------------------------------------
OpenBSD clang version 8.0.1 (tags/RELEASE_801/final)
                            (based on LLVM 8.0.1)
Target: amd64-unknown-openbsd6.6
----------------------------------------------------
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
(__STDC_ISO_10646__ is 201706)
Quuxplusone commented 4 years ago

Please tell us if you have verified this property for every possible locale definition (not necessarily restricted to ones available through the relevant default package repository) on the relevant platforms. Please also tell us if GCC defines the macro for the platforms in question.