limits.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  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
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_LIMITS_H
  10. #define _LIBCPP_LIMITS_H
  11. /*
  12. limits.h synopsis
  13. Macros:
  14. CHAR_BIT
  15. SCHAR_MIN
  16. SCHAR_MAX
  17. UCHAR_MAX
  18. CHAR_MIN
  19. CHAR_MAX
  20. MB_LEN_MAX
  21. SHRT_MIN
  22. SHRT_MAX
  23. USHRT_MAX
  24. INT_MIN
  25. INT_MAX
  26. UINT_MAX
  27. LONG_MIN
  28. LONG_MAX
  29. ULONG_MAX
  30. LLONG_MIN // C99
  31. LLONG_MAX // C99
  32. ULLONG_MAX // C99
  33. */
  34. #include <__config>
  35. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  36. # pragma GCC system_header
  37. #endif
  38. #ifdef _LIBCPP_COMPILER_GCC
  39. // GCC header limits.h recursively includes itself through another header called
  40. // syslimits.h for some reason. This setup breaks down if we directly
  41. // #include_next GCC's limits.h (reasons not entirely clear to me).
  42. // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107795 for more details.
  43. // Therefore, we manually re-create the necessary include sequence below:
  44. // Get the system limits.h defines (force recurse into the next level)
  45. #define _GCC_LIMITS_H_
  46. #define _GCC_NEXT_LIMITS_H
  47. #include_next <limits.h>
  48. // Get the ISO C defines
  49. #undef _GCC_LIMITS_H_
  50. #include_next <limits.h>
  51. #else
  52. # if __has_include_next(<limits.h>)
  53. # include_next <limits.h>
  54. # endif
  55. #endif // _LIBCPP_COMPILER_GCC
  56. #endif // _LIBCPP_LIMITS_H