[PATCH] D106577: [clang] Define __STDC_ISO_10646__

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 11:05:29 PDT 2021


cor3ntin created this revision.
Herald added subscribers: s.egerton, simoncook, dschuff.
cor3ntin requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

Both C and C++ standard suggest that the macro

__STDC_ISO_10646__ should be defined when
wchar_t can represent all unicode characters.

Because pending D93031 <https://reviews.llvm.org/D93031>, clang only support
UTF-16 or UTF-32 as the wide execution encoding,
wchar_t can represent all Unicode characters
whenever wchar_t is at least 21 bits.

But clang only seem to support 2 or 4 bytes
wchar_t so only define __STDC_ISO_10646__
when wchar_t is at least 4 bytes.

The value is rather meaning less as
the version of Unicode is unlikely affect
its codespace, or we would have bigger problems.
We set it to the publication of Unicode 13.

Note that this define was set up already
in the CloudABI target.

This project seems unmaintained,
and for the sake of simplicity i elected to change
the value used there.
(only the presence of the macro is likely to be checked).

When D93031 <https://reviews.llvm.org/D93031> is approved this code can be
extended to check a user defined wide execution
encoding. We could also imagine a per-target (OS)
default wide execution encoding. EG for wide ebcdic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106577

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Preprocessor/init-aarch64.c
  clang/test/Preprocessor/init-x86.c
  clang/test/Preprocessor/init.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106577.360890.patch
Type: text/x-patch
Size: 5265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210722/9b7903c9/attachment.bin>


More information about the cfe-commits mailing list