• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // -*- C++ -*-
2 //===--------------------------- limits.h ---------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef _LIBCPP_LIMITS_H
12 #define _LIBCPP_LIMITS_H
13 
14 /*
15     limits.h synopsis
16 
17 Macros:
18 
19     CHAR_BIT
20     SCHAR_MIN
21     SCHAR_MAX
22     UCHAR_MAX
23     CHAR_MIN
24     CHAR_MAX
25     MB_LEN_MAX
26     SHRT_MIN
27     SHRT_MAX
28     USHRT_MAX
29     INT_MIN
30     INT_MAX
31     UINT_MAX
32     LONG_MIN
33     LONG_MAX
34     ULONG_MAX
35     LLONG_MIN   // C99
36     LLONG_MAX   // C99
37     ULLONG_MAX  // C99
38 
39 */
40 
41 #include <__config>
42 
43 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
44 #pragma GCC system_header
45 #endif
46 
47 #ifndef __GNUC__
48 #include_next <limits.h>
49 #else
50 // GCC header limits.h recursively includes itself through another header called
51 // syslimits.h for some reason. This setup breaks down if we directly
52 // #include_next GCC's limits.h (reasons not entirely clear to me). Therefore,
53 // we manually re-create the necessary include sequence below:
54 
55 // Get the system limits.h defines (force recurse into the next level)
56 #define _GCC_LIMITS_H_
57 #define _GCC_NEXT_LIMITS_H
58 #include_next <limits.h>
59 
60 // Get the ISO C defines
61 #undef _GCC_LIMITS_H_
62 #include_next <limits.h>
63 #endif // __GNUC__
64 
65 #endif  // _LIBCPP_LIMITS_H
66