]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/clang/include/llvm/Support/DataTypes.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
[FreeBSD/FreeBSD.git] / lib / clang / include / llvm / Support / DataTypes.h
1 /* $FreeBSD$ */
2 /*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
3 |*                                                                            *|
4 |*                     The LLVM Compiler Infrastructure                       *|
5 |*                                                                            *|
6 |* This file is distributed under the University of Illinois Open Source      *|
7 |* License. See LICENSE.TXT for details.                                      *|
8 |*                                                                            *|
9 |*===----------------------------------------------------------------------===*|
10 |*                                                                            *|
11 |* This file contains definitions to figure out the size of _HOST_ data types.*|
12 |* This file is important because different host OS's define different macros,*|
13 |* which makes portability tough.  This file exports the following            *|
14 |* definitions:                                                               *|
15 |*                                                                            *|
16 |*   [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
17 |*   [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.     *|
18 |*                                                                            *|
19 |* No library is required when using these functions.                         *|
20 |*                                                                            *|
21 |*===----------------------------------------------------------------------===*/
22
23 /* Please leave this file C-compatible. */
24
25 #ifndef SUPPORT_DATATYPES_H
26 #define SUPPORT_DATATYPES_H
27
28 #define HAVE_INTTYPES_H 1
29 #define HAVE_STDINT_H 1
30 #define HAVE_UINT64_T 1
31 #define HAVE_U_INT64_T 1
32
33 #ifdef __cplusplus
34 #include <cmath>
35 #else
36 #include <math.h>
37 #endif
38
39 #ifdef __cplusplus
40 #include <cinttypes>
41 #else
42 #ifdef HAVE_INTTYPES_H
43 #include <inttypes.h>
44 #endif
45 #endif
46
47 #ifdef __cplusplus
48 #include <cstdint>
49 #else
50 #ifdef HAVE_STDINT_H
51 #include <stdint.h>
52 #else
53 #error "Compiler must provide an implementation of stdint.h"
54 #endif
55 #endif
56
57 #ifndef _MSC_VER
58
59 #if !defined(UINT32_MAX)
60 # error "The standard header <cstdint> is not C++11 compliant. Must #define "\
61         "__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
62 #endif
63
64 #if !defined(UINT32_C)
65 # error "The standard header <cstdint> is not C++11 compliant. Must #define "\
66         "__STDC_CONSTANT_MACROS before #including Support/DataTypes.h"
67 #endif
68
69 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
70 #include <sys/types.h>
71
72 #ifdef _AIX
73 // GCC is strict about defining large constants: they must have LL modifier.
74 #undef INT64_MAX
75 #undef INT64_MIN
76 #endif
77
78 /* Handle incorrect definition of uint64_t as u_int64_t */
79 #ifndef HAVE_UINT64_T
80 #ifdef HAVE_U_INT64_T
81 typedef u_int64_t uint64_t;
82 #else
83 # error "Don't have a definition for uint64_t on this platform"
84 #endif
85 #endif
86
87 #else /* _MSC_VER */
88 #ifdef __cplusplus
89 #include <cstddef>
90 #include <cstdlib>
91 #else
92 #include <stddef.h>
93 #include <stdlib.h>
94 #endif
95 #include <sys/types.h>
96
97 #if defined(_WIN64)
98 typedef signed __int64 ssize_t;
99 #else
100 typedef signed int ssize_t;
101 #endif /* _WIN64 */
102
103 #ifndef HAVE_INTTYPES_H
104 #define PRId64 "I64d"
105 #define PRIi64 "I64i"
106 #define PRIo64 "I64o"
107 #define PRIu64 "I64u"
108 #define PRIx64 "I64x"
109 #define PRIX64 "I64X"
110
111 #define PRId32 "d"
112 #define PRIi32 "i"
113 #define PRIo32 "o"
114 #define PRIu32 "u"
115 #define PRIx32 "x"
116 #define PRIX32 "X"
117 #endif /* HAVE_INTTYPES_H */
118
119 #endif /* _MSC_VER */
120
121 /* Set defaults for constants which we cannot find. */
122 #if !defined(INT64_MAX)
123 # define INT64_MAX 9223372036854775807LL
124 #endif
125 #if !defined(INT64_MIN)
126 # define INT64_MIN ((-INT64_MAX)-1)
127 #endif
128 #if !defined(UINT64_MAX)
129 # define UINT64_MAX 0xffffffffffffffffULL
130 #endif
131
132 #ifndef HUGE_VALF
133 #define HUGE_VALF (float)HUGE_VAL
134 #endif
135
136 #endif /* SUPPORT_DATATYPES_H */