Asiri Rathnayake | b2c2ed5 | 2016-10-10 08:38:51 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- limits.h ---------------------------------===// |
| 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame^] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Asiri Rathnayake | b2c2ed5 | 2016-10-10 08:38:51 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_LIMITS_H |
| 11 | #define _LIBCPP_LIMITS_H |
| 12 | |
| 13 | /* |
| 14 | limits.h synopsis |
| 15 | |
| 16 | Macros: |
| 17 | |
| 18 | CHAR_BIT |
| 19 | SCHAR_MIN |
| 20 | SCHAR_MAX |
| 21 | UCHAR_MAX |
| 22 | CHAR_MIN |
| 23 | CHAR_MAX |
| 24 | MB_LEN_MAX |
| 25 | SHRT_MIN |
| 26 | SHRT_MAX |
| 27 | USHRT_MAX |
| 28 | INT_MIN |
| 29 | INT_MAX |
| 30 | UINT_MAX |
| 31 | LONG_MIN |
| 32 | LONG_MAX |
| 33 | ULONG_MAX |
| 34 | LLONG_MIN // C99 |
| 35 | LLONG_MAX // C99 |
| 36 | ULLONG_MAX // C99 |
| 37 | |
| 38 | */ |
| 39 | |
| 40 | #include <__config> |
| 41 | |
| 42 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 43 | #pragma GCC system_header |
| 44 | #endif |
| 45 | |
Asiri Rathnayake | 9e4cc01 | 2016-10-10 15:56:01 +0000 | [diff] [blame] | 46 | #ifndef __GNUC__ |
Asiri Rathnayake | b2c2ed5 | 2016-10-10 08:38:51 +0000 | [diff] [blame] | 47 | #include_next <limits.h> |
Asiri Rathnayake | 9e4cc01 | 2016-10-10 15:56:01 +0000 | [diff] [blame] | 48 | #else |
| 49 | // GCC header limits.h recursively includes itself through another header called |
| 50 | // syslimits.h for some reason. This setup breaks down if we directly |
| 51 | // #include_next GCC's limits.h (reasons not entirely clear to me). Therefore, |
| 52 | // we manually re-create the necessary include sequence below: |
| 53 | |
| 54 | // Get the system limits.h defines (force recurse into the next level) |
| 55 | #define _GCC_LIMITS_H_ |
| 56 | #define _GCC_NEXT_LIMITS_H |
| 57 | #include_next <limits.h> |
| 58 | |
| 59 | // Get the ISO C defines |
| 60 | #undef _GCC_LIMITS_H_ |
| 61 | #include_next <limits.h> |
| 62 | #endif // __GNUC__ |
Asiri Rathnayake | b2c2ed5 | 2016-10-10 08:38:51 +0000 | [diff] [blame] | 63 | |
| 64 | #endif // _LIBCPP_LIMITS_H |