[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2022-09-19 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment. In D106577#3799276 , @aaron.ballman wrote: > Sorry, thanks for re-pinging this, it fell off my radar. Yes, I have heard > back from WG14 but there was not really a consensus position (which means > we'd need to write a paper if

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2022-09-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#3799067 , @mgorny wrote: > In D106577#2965059 , @aaron.ballman > wrote: > >> Thanks! I've passed them along to WG14 and will report back what I hear. > > Have you heard a

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2022-09-19 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment. In D106577#2965059 , @aaron.ballman wrote: > Thanks! I've passed them along to WG14 and will report back what I hear. Have you heard anything since? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://rev

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2022-02-23 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin abandoned this revision. cor3ntin added a comment. Herald added subscribers: pcwang-thead, luke957. Based on feedback, I will not pursue this any further (unless WG14 decides to tackle the issue) Thanks for the comments! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-09-06 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment. In D106577#2983709 , @ThePhD wrote: > What it does mean is that Clang and every other compiler - so long as they > pick a ISO10646-code point capable encoding for their `wchar_t` literals - > can define this prepr

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-09-04 Thread ThePhD via Phabricator via cfe-commits
ThePhD added a comment. Hi, my name is JeanHeyd Meneide. I'm the Project Editor for C, but more importantly I'm the author of this paper: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2728.htm This paper was accepted yesterday (September 3rd, 2021) into the C Standard, and (after I merge it

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2958633 , @jyknight wrote: > In D106577#2944086 , @aaron.ballman > wrote: > >> @jyknight, are you on the WG14 reflectors btw? Would you like to carry on >> with this dis

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-20 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D106577#2944086 , @aaron.ballman wrote: >> I don't think that scenario is valid. MBCS-to-unicode mappings are a part of >> the definition of the MBCS (sometimes officially, sometimes de-facto defined >> by major vendors), n

Re: [PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-13 Thread Corentin via cfe-commits
On Fri, Aug 13, 2021 at 7:42 PM Aaron Ballman via Phabricator < revi...@reviews.llvm.org> wrote: > aaron.ballman added a comment. > > In D106577#2943837 , @jyknight > wrote: > > > In D106577#2904960 , @rsmith > wro

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2943837 , @jyknight wrote: > In D106577#2904960 , @rsmith wrote: > >>> One specific example I'd like to be considered: >>> Suppose the C standard library implementation's

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-13 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D106577#2904960 , @rsmith wrote: >> One specific example I'd like to be considered: >> Suppose the C standard library implementation's mbstowcs converts a certain >> multi-byte character C to somewhere in the Unicode private

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-08-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2906542 , @rsmith wrote: > If Aaron's checked with WG14 and the intent is for this to only constrain how > literals are represented, and not the complete implementation, then I'm > entirely fine with us defining

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-27 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. BTW, looks like the standard wording came from: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_273.htm which indeed seems to suggest that the intent was to: 1. ensure that WCHAR_MAX is at least the maximum character actually defined so far by the standard (which in

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-27 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D106577#2905027 , @aaron.ballman wrote: > In D106577#2904960 , @rsmith wrote: > >> I'd expect we will break at least things like libc++ tests that build with >> `-Wsystem-headers` in t

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. > I still don't fully understand the original comment from Joerg. The encoding > of `L'a'` cannot change at runtime; it's a literal whose encoding is decided > entirely at compile time. @joerg -- did you mean that Clang produces a > different literal encoding depending on

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D106577#2904960 , @rsmith wrote: > One benefit we don't get with this approach is providing the right value for > the macro (without paying the cost of always including `stdc-predefs.h`). What do you mean by "right value", t

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D106577#2905027 , @aaron.ballman wrote: >> That doesn't help the fact that wide char literals are effectively broken on >> those OSes, but oh well. Maybe someday they'll decide to switch to a >> consistent/documented wchar

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2904724 , @jyknight wrote: > Perhaps a reasonable path forward here to address the BSD issue can be to add > a targetinfo method: > > /* Returns true if the expected encoding of wchar_t changes at runtime >

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D106577#2904078 , @aaron.ballman wrote: > In D106577#2902091 , @jyknight > wrote: > >> In D106577#2901654 , @rsmith wrote: >> >>> I think this

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. Perhaps a reasonable path forward here to address the BSD issue can be to add a targetinfo method: /* Returns true if the expected encoding of wchar_t changes at runtime depending on locale for this target. Note that clang always encodes wide character liter

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 361639. cor3ntin added a comment. Herald added a project: clang-tools-extra. Fix tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106577/new/ https://reviews.llvm.org/D106577 Files: clang-tools-extra/te

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2902091 , @jyknight wrote: > In D106577#2901654 , @rsmith wrote: > >> I think this patch as it stands would cause problems with libc >> implementations that put their `#d

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D106577#2901654 , @rsmith wrote: > I think this patch as it stands would cause problems with libc > implementations that put their `#define` somewhere other than than > `stdc-predef.h` (eg, older versions of glibc that put i

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. I think this patch as it stands would cause problems with libc implementations that put their `#define` somewhere other than than `stdc-predef.h` (eg, older versions of glibc that put it in `features.h` or other standard libraries that put it in `yvals.h`) due to the mac

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. In D106577#2899715 , @aaron.ballman wrote: > In D106577#2899711 , @joerg wrote: > >> This patch is certainly wrong for NetBSD as the wchar_t encoding is up to >> the specific locale charse

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. Even after the more recent discussion, I still think my initial message was incorrect, and that the compiler should be defining this macro itself, as proposed in this patch. Note that my confusion was not that the macro being defined or not was dependent on libc behavi

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D106577#2899715 , @aaron.ballman wrote: > In D106577#2899711 , @joerg wrote: > >> This patch is certainly wrong for NetBSD as the wchar_t encoding is up to >> the specific locale cha

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2899711 , @joerg wrote: > This patch is certainly wrong for NetBSD as the wchar_t encoding is up to the > specific locale charset and *not* UCS-2 or UCS-4 for certain legacy encodings > like the various shift en

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman requested changes to this revision. aaron.ballman added a comment. This revision now requires changes to proceed. In D106577#2899574 , @cor3ntin wrote: > In D106577#2898967 , > @hubert.reinterpretca

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment. This patch is certainly wrong for NetBSD as the wchar_t encoding is up to the specific locale charset and *not* UCS-2 or UCS-4 for certain legacy encodings like the various shift encodings in East Asia. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION h

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-23 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D106577#2898967 , @hubert.reinterpretcast wrote: > In D106577#2897588 , @aaron.ballman > wrote: > >> In D106577#2897522 , @jyknight >> wrot

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment. In D106577#2897588 , @aaron.ballman wrote: > In D106577#2897522 , @jyknight > wrote: > >> I'm not sure we should be populating this. >> >> The _value_ is determined by wha

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D106577#2897588 , @aaron.ballman wrote: > In D106577#2897522 , @jyknight > wrote: > >> I'm not sure we should be populating this. >> >> The _value_ is determined by what libc support

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D106577#2897588 , @aaron.ballman wrote: > In D106577#2897522 , @jyknight > wrote: > >> I'm not sure we should be populating this. >> >> The _value_ is determined by what libc support

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D106577#2897522 , @jyknight wrote: > I'm not sure we should be populating this. > > The _value_ is determined by what libc supports, so it probably needs to be > left up to libc to define it. Why is the value determined

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. I'm not sure we should be populating this. The _value_ is determined by what libc supports, so it probably needs to be left up to libc to define it. In glibc, this define is set by the file /usr/include/stdc-predef.h, which GCC implicitly includes into all TUs whether

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D106577#2897450 , @cor3ntin wrote: > In D106577#2897312 , @aaron.ballman > wrote: > >> Can

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 360914. cor3ntin added a comment. Remove braces, improve comment (Thanks Aaron) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106577/new/ https://reviews.llvm.org/D106577 Files: clang/lib/Basic/Targets/OSTa

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D106577#2897312 , @aaron.ballman wrote: > Can you also add a test that explicitly uses `-fshort-wchar` to verify that > we don't predefine the macro? There is one already! (init.c L288) Comment at: clang

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: aaron.ballman, rsmith, jyknight. aaron.ballman added a comment. Can you also add a test that explicitly uses `-fshort-wchar` to verify that we don't predefine the macro? Comment at: clang/lib/Frontend/InitPreprocessor.cpp:430-435 + // Because Cl

[PATCH] D106577: [clang] Define __STDC_ISO_10646__

2021-07-22 Thread Corentin Jabot via Phabricator via cfe-commits
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 w