Futher reduce the includes of our builtin headers, and teach limits.h to avoid
include_next when not hosted or unavailable. This follows the pattern in
stdint.h and allows these headers to work even in a freestanding configuration
without a standard library.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119343 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Headers/limits.h b/lib/Headers/limits.h
index 2627533..ecd09a4 100644
--- a/lib/Headers/limits.h
+++ b/lib/Headers/limits.h
@@ -31,8 +31,12 @@
 #define _GCC_LIMITS_H_
 #endif
 
-/* System headers include a number of constants from POSIX in <limits.h>. */
+/* System headers include a number of constants from POSIX in <limits.h>.
+   Include it if we're hosted. */
+#if __STDC_HOSTED__ && \
+    defined(__has_include_next) && __has_include_next(<limits.h>)
 #include_next <limits.h>
+#endif
 
 /* Many system headers try to "help us out" by defining these.  No really, we
    know how big each datatype is. */