[PATCH] D157793: [Headers] Add missing __need_ macros to stdarg.h

Ian Anderson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 10:11:20 PDT 2023


iana added a comment.

In D157793#4585268 <https://reviews.llvm.org/D157793#4585268>, @aaron.ballman wrote:

> In D157793#4583698 <https://reviews.llvm.org/D157793#4583698>, @iana wrote:
>
>> In D157793#4583663 <https://reviews.llvm.org/D157793#4583663>, @MaskRay wrote:
>>
>>>> Apple needs a __need_ macro for va_list. Add one, and also ones for va_start/va_arg/va_end, __va_copy, va_copy.
>>>
>>> Do you have a link to the specification or the source that this is needed?
>>
>> We need is so that our <sys/_types/_va_list.h> doesn't have to redeclare va_list and doesn't pull in all of stdarg.h either. As far as I know there's no specification for this (or stddef.h) being include-able in pieces.
>
> I'm not opposed, but this adds significant complexity to support a questionable use case -- the C standard library headers are not intended to be partially included, so if the plan is to use these `__need` macros in all of the headers we provide, I think that should go through an RFC process to be sure we want to maintain the added complexity. (Also, who is "we" in this case?)

We is Apple. We have a <sys/_types/_va_list.h> header that is generating redeclaration warnings in modules mode. I can't just include <stdarg.h> instead since it would change the semantics of <sys/_types/_va_list.h>. stdarg.h and stddef.h appear to be the only clang headers that Apple needs to use in pieces though, I don't think we should add this complexity to any other headers for consistency or "just because".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157793



More information about the cfe-commits mailing list