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

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 11:10:49 PDT 2023


jrtc27 added inline comments.


================
Comment at: clang/lib/Headers/stdckdint.h:12
+#define __STDCKDINT_H
+
+/* C23 7.20.1 Defines several macros for performing checked integer arithmetic*/
----------------
pirama wrote:
> aaron.ballman wrote:
> > Should a hosted build attempt to do an include_next into the system library and then fall back to the compiler builtins, or should we treat this like stdbool.h where the compiler always wins? CC @jyknight @jrtc27 @efriedma 
> > 
> > My intuition is that we want to include_next in case the system has better facilities than the compiler does.
> The `include_next` question is still open.  Any preference here?
> 
> IMO, since the standard explicitly delegates to the compiler builtin when available, we may not need to `include_next` - unless there are other conventions around this.
FreeBSD has just added an implementation because Clang doesn’t have one. GCC will include_next if _LIBC_STDCKDINT_H isn’t defined and there is a header to include. I don’t really know why that exists to be honest, I don’t see a use for it and view this like foointrin.h headers. But probably we should be compatible with that. I don’t see a use case for it in FreeBSD though.


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