[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

Elliott Hughes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 12:13:53 PST 2023


enh added a comment.

In D137268#4069856 <https://reviews.llvm.org/D137268#4069856>, @zatrazz wrote:

> I think I have caught this because your standard conformance tests checks for __gnuc_va_list 
> on wchar.h, wich is always defined on on GCC (git log shows it was changed to fix XPG7 
> tests, but I am not sure exactly why the author has changed the va_list to __gnuc_va_list).

bionic's tests check for `va_list`, because that's what POSIX says will be visible. ISO C doesn't say that, so i think the _intention_ for glibc -- musl seems to do this correctly -- is to say "if we're only compiling C source, you don't get `va_list`, but if we're compiling POSIX source, you do get `va_list`". so i think this `__gnuc_va_list` thing is their workaround to still export the _functions_ without exporting the _type_ for ISO C?

here's the bionic *POSIX* test: https://cs.android.com/android/platform/superproject/+/master:bionic/tests/headers/posix/wchar_h.c;l=38 (but note that you'll have to look at the corresponding Android.bp file to see us define `_POSIX_SOURCE`.) note that our tests pass against _bionic_ (and, i think, musl). it's just old-glibc-with-new-llvm they fail against.

> And it seems that glibc seems broken also using GCC stdarg.h if I fix the test to check for
> va_list instead. I will take a look at this.

thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268



More information about the cfe-commits mailing list