limits.h 1.5 KB

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