[PATCH] D157757: [Headers] Replace __need_STDDEF_H_misc with specific __need_ macros
Ian Anderson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 14:30:05 PDT 2023
iana marked an inline comment as done.
iana added inline comments.
================
Comment at: clang/lib/Headers/stddef.h:16
+ defined(__need_wint_t) || \
+ (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1)
----------------
aaron.ballman wrote:
> C23 K.3.1.1p2: The functions, macros, and types declared or defined in K.3 and its subclauses are declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is defined as a macro which expands to the integer constant 1 at the point in the source file where the appropriate header is first included.
>
> So I don't think this should be `>= 1`. Same below. (Though I notice we seem to do this in other places, so perhaps that's more of a general cleanup we should make?)
`>=1` is what stddef.h was already doing, so I'd vote do this later as general cleanup.
================
Comment at: clang/test/Headers/stddef.c:1-3
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=c99 -std=c99 %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=c11 -std=c11 %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=c23 -std=c23 %s
----------------
aaron.ballman wrote:
> Are the triples necessary? Better if we can remove them.
They shouldn't be, I just copied them from stddefneeds.cpp, let me try getting rid of them
================
Comment at: clang/test/Headers/stddef.c:7
+
+ptrdiff_t p0; // c99-error{{unknown}} c11-error{{unknown}} c23-error{{unknown}}
+size_t s0; // c99-error{{unknown}} c11-error{{unknown}} c23-error{{unknown}}
----------------
aaron.ballman wrote:
> At least one of these `unknown` errors should be fully spelled out (the rest can then be assumed to be the same wording as the long-form).
Let me know how this looks, I can just fully expand all of them if you prefer. I was going by stddefneeds.cpp as an example.
================
Comment at: clang/test/Headers/stddefneeds.c:1-2
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=c99 -std=c99 %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.9.0 -verify=c23 -std=c23 %s
+
----------------
aaron.ballman wrote:
> Do we need the triples?
Looks like no.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157757/new/
https://reviews.llvm.org/D157757
More information about the cfe-commits
mailing list