limits.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #ifndef __GNUC__
  39. #include_next <limits.h>
  40. #else
  41. // GCC header limits.h recursively includes itself through another header called
  42. // syslimits.h for some reason. This setup breaks down if we directly
  43. // #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
  44. // we manually re-create the necessary include sequence below:
  45. // Get the system limits.h defines (force recurse into the next level)
  46. #define _GCC_LIMITS_H_
  47. #define _GCC_NEXT_LIMITS_H
  48. #include_next <limits.h>
  49. // Get the ISO C defines
  50. #undef _GCC_LIMITS_H_
  51. #include_next <limits.h>
  52. #endif // __GNUC__
  53. #endif // _LIBCPP_LIMITS_H