[libcxx] Fix gcc build.

Attempt to fix a horrible gcc include order problem.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283762 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Asiri Rathnayake 2016-10-10 15:56:01 +00:00
parent 742d878b02
commit f7b867b342

View File

@ -44,6 +44,22 @@ Macros:
#pragma GCC system_header
#endif
#ifndef __GNUC__
#include_next <limits.h>
#else
// GCC header limits.h recursively includes itself through another header called
// syslimits.h for some reason. This setup breaks down if we directly
// #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
// we manually re-create the necessary include sequence below:
// Get the system limits.h defines (force recurse into the next level)
#define _GCC_LIMITS_H_
#define _GCC_NEXT_LIMITS_H
#include_next <limits.h>
// Get the ISO C defines
#undef _GCC_LIMITS_H_
#include_next <limits.h>
#endif // __GNUC__
#endif // _LIBCPP_LIMITS_H