As reported in llvm bugzilla 32377.
Here’s a patch to add preinclude of stdc-predef.h.
The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html;
The preinclude is inhibited with –ffreestanding.
Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior.
I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here
I don't see why it makes any sense to condition this based on a GCC installation existing and being >= 4.8, since this header comes from libc, and is necessary for standards compliance even if there's absolutely no GCC installed or involved.
Additionally, something like this -- a way for the libc to be involved in setting up predefined macros -- seems probably necessary for *any* libc, if they want to be strictly standards-compliant. Some of the required-to-be-predefined macros like __STDC_ISO_10646__ can only really be provided by the libc, since the appropriate value is dependent on the locale implementation in the libc, and not on the compiler at all.
It's possible that glibc on Linux is the only one who's cared to implement it thus far (and, only when you're using GCC, at that, hence this change...). That seems likely, really, since mostly the impacted macros are nearly useless, so who cares... :) However, if others want to be conforming, I expect they _ought_ to be using this mechanism, as well...
Thus, perhaps it ought to be an unconditional behavior of clang to include the file if it exists, unless -ffreestanding is passed.