xref: /openbsd-src/gnu/llvm/libcxx/include/limits.h (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
146035553Spatrick // -*- C++ -*-
2*4bdff4beSrobert //===----------------------------------------------------------------------===//
346035553Spatrick //
446035553Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
546035553Spatrick // See https://llvm.org/LICENSE.txt for license information.
646035553Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
746035553Spatrick //
846035553Spatrick //===----------------------------------------------------------------------===//
946035553Spatrick 
1046035553Spatrick #ifndef _LIBCPP_LIMITS_H
1146035553Spatrick #define _LIBCPP_LIMITS_H
1246035553Spatrick 
1346035553Spatrick /*
1446035553Spatrick     limits.h synopsis
1546035553Spatrick 
1646035553Spatrick Macros:
1746035553Spatrick 
1846035553Spatrick     CHAR_BIT
1946035553Spatrick     SCHAR_MIN
2046035553Spatrick     SCHAR_MAX
2146035553Spatrick     UCHAR_MAX
2246035553Spatrick     CHAR_MIN
2346035553Spatrick     CHAR_MAX
2446035553Spatrick     MB_LEN_MAX
2546035553Spatrick     SHRT_MIN
2646035553Spatrick     SHRT_MAX
2746035553Spatrick     USHRT_MAX
2846035553Spatrick     INT_MIN
2946035553Spatrick     INT_MAX
3046035553Spatrick     UINT_MAX
3146035553Spatrick     LONG_MIN
3246035553Spatrick     LONG_MAX
3346035553Spatrick     ULONG_MAX
3446035553Spatrick     LLONG_MIN   // C99
3546035553Spatrick     LLONG_MAX   // C99
3646035553Spatrick     ULLONG_MAX  // C99
3746035553Spatrick 
3846035553Spatrick */
3946035553Spatrick 
4046035553Spatrick #include <__config>
4146035553Spatrick 
4246035553Spatrick #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4346035553Spatrick #  pragma GCC system_header
4446035553Spatrick #endif
4546035553Spatrick 
46*4bdff4beSrobert #ifdef _LIBCPP_COMPILER_GCC
47*4bdff4beSrobert 
4846035553Spatrick // GCC header limits.h recursively includes itself through another header called
4946035553Spatrick // syslimits.h for some reason. This setup breaks down if we directly
50*4bdff4beSrobert // #include_next GCC's limits.h (reasons not entirely clear to me).
51*4bdff4beSrobert // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107795 for more details.
52*4bdff4beSrobert // Therefore, we manually re-create the necessary include sequence below:
5346035553Spatrick 
5446035553Spatrick // Get the system limits.h defines (force recurse into the next level)
5546035553Spatrick #define _GCC_LIMITS_H_
5646035553Spatrick #define _GCC_NEXT_LIMITS_H
5746035553Spatrick #include_next <limits.h>
5846035553Spatrick 
5946035553Spatrick // Get the ISO C defines
6046035553Spatrick #undef _GCC_LIMITS_H_
6146035553Spatrick #include_next <limits.h>
62*4bdff4beSrobert 
63*4bdff4beSrobert #else
64*4bdff4beSrobert 
65*4bdff4beSrobert #  if __has_include_next(<limits.h>)
66*4bdff4beSrobert #    include_next <limits.h>
67*4bdff4beSrobert #  endif
68*4bdff4beSrobert 
69*4bdff4beSrobert #endif // _LIBCPP_COMPILER_GCC
7046035553Spatrick 
7146035553Spatrick #endif // _LIBCPP_LIMITS_H
72