[PATCH] D157331: [clang] Implement C23 <stdckdint.h>

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 05:30:58 PDT 2023


aaron.ballman added a comment.

In D157331#4575224 <https://reviews.llvm.org/D157331#4575224>, @ZijunZhao wrote:

> Another followup question: I check https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2683.pdf and I only add Core Proposal here. Do I need to add Supplemental Proposal, like some types?

Ah, this is a bit confusing! tl;dr: No need to add the supplemental proposal.

The way to trace this down yourself is:

- The working draft (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf) has a list of what papers were adopted and applied to the standard. You'll find N2683 under the June 2021 virtual meeting heading. That's how you know which paper was adopted.
- You can look at the paper to see the proposed wording, prior art, motivation, etc. That gets you 95% of the way but you need to know what words actually went into the standard. So use the original paper to give you ideas on what to implement, what to test, etc, but verify against the wording in the standard.
- Because this was discussed at the June 2021 virtual meeting, you should look at those meeting minutes (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2802.pdf) to see what was adopted. You can search for `2683` to find the relevant discussion in the minutes. Most importantly, you can see what polls were taken. The two polls of interest were:

Straw Poll: Does the committee wish to adopt the Core proposal from N2683 into C23? 13-0-5 Core proposal goes into C23.
Straw Poll: Does the committee want the "ckd_" identifiers from N2683's Core proposal in future library directions to be potentially reserved identifiers? 18-0-0

This is how we know that only the core proposal was added, and not the supplemental proposal. Checking that belief against the standard wording itself verifies that only the core proposal was added and the supplemental bits are left out.

(Hopefully that explanation makes some sense, but if you have more questions, just ask!)



================
Comment at: clang/test/Headers/stdckdint.cpp:1
+// RUN: %clang_cc1 -emit-llvm -fgnuc-version=4.2.1 -std=gnu++11 %s -o - | FileCheck %s
+
----------------
aaron.ballman wrote:
> hiraditya wrote:
> > aaron.ballman wrote:
> > > ZijunZhao wrote:
> > > > enh wrote:
> > > > > ZijunZhao wrote:
> > > > > > enh wrote:
> > > > > > > ZijunZhao wrote:
> > > > > > > > enh wrote:
> > > > > > > > > hiraditya wrote:
> > > > > > > > > > seems like we don't have a -std=gnu23, or -std=c23 standard flag for this in clang yet.
> > > > > > > > > > 
> > > > > > > > > > https://godbolt.org/z/7dKnGEWWE
> > > > > > > > > > 
> > > > > > > > > > we probably need it before testing stdckdint i guess?
> > > > > > > > > other headers just use > and the previous version. (though see stdalign.h if you're looking for some random cleanup to do!)
> > > > > > > > > seems like we don't have a -std=gnu23, or -std=c23 standard flag for this in clang yet.
> > > > > > > > 
> > > > > > > > In the local testing, `-std=c++23` works  and all tests pass😂 
> > > > > > > > 
> > > > > > > > 
> > > > > > > C23 != C++23... they don't even really coordinate with one another... talk to hboehm about that some time :-)
> > > > > > ohhh I think `gnu++23` != `gnu23` either 😂 
> > > > > correct. the "c" or "c++" part means "standard stuff" and replacing it with "gnu" or "gnu++" means "standard stuff _and_ extensions".
> > > > I try to grep "std>" in `clang/test/Headers` but find nothing, and nothing in stdalign.h is about `>`
> > > This isn't a GNU feature, so we don't need to enable a GNU mode or set a gnu version. (Note, the file should be a .c file, not a .cpp file)
> > Do we have plans to add -std=c23 anytime soon? `-std=c2x` defines `__STDC_VERSION__ 202000L`
> > Do we have plans to add -std=c23 anytime soon? -std=c2x defines __STDC_VERSION__ 202000L
> 
> We needed to wait for WG14 to finalize the standard before we could decide what name to use or what macro value to pick. Both are settled now, so I plan to make those changes Sometime Soonâ„¢ 
The user-facing parts of those changes are at https://reviews.llvm.org/D157606


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157331/new/

https://reviews.llvm.org/D157331



More information about the cfe-commits mailing list