RTI Connext DDS Micro
Version 2.4.10
Main Page
Related Pages
Manuals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
osapi_cc_stdc.h
Go to the documentation of this file.
1
/*
2
* FILE: osapi_cc_stdc.h - Specific compiler related definitions
3
*
4
* (c) Copyright, Real-Time Innovations, 2012-2016
5
*
6
* All rights reserved.
7
*
8
* No duplications, whole or partial, manual or electronic, may be made
9
* without express written permission. Any such copies, or
10
* revisions thereof, must display this notice unaltered.
11
* This code contains trade secrets of Real-Time Innovations, Inc.
12
*
13
* Modification History
14
* --------------------
15
* 28jul2016,tk Refactored from osapi_config.h
16
*/
17
/*ce \file
18
* \brief OS API Configuration
19
*/
20
#ifndef osapi_cc_stdc_h
21
#define osapi_cc_stdc_h
22
23
/* NOTE: We (RTI) build for Windows using a cygwin cpp.exe to generate
24
* the dependencies. In addition, MSC only defines __STDC__ when using the /Za
25
* option. Thus, check for more than just __STDC__ as we test MSC
26
*/
27
#if !defined(__STDC__) && !defined(_MSC_VER) && !defined(RTI_WIN32)
28
#error "osapi_cc_stdc.h used used with a non-standard C compiler"
29
#endif
30
31
#include <limits.h>
32
#include <stddef.h>
33
34
/*******************************************************************************
35
* Define types for for MS VS. The supported types can be found here:
36
*
37
* https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
38
******************************************************************************/
39
#if defined(_MSC_VER) || defined(RTI_WIN32)
40
41
typedef
signed
char
RTI_INT8;
42
typedef
unsigned
char
RTI_UINT8;
43
typedef
signed
short
RTI_INT16;
44
typedef
unsigned
short
RTI_UINT16;
45
typedef
signed
int
RTI_INT32;
46
typedef
unsigned
int
RTI_UINT32;
47
typedef
signed
long
long
RTI_INT64;
48
typedef
unsigned
long
long
RTI_UINT64;
49
50
#define RTI_HAVE_FLOAT
51
typedef
float
RTI_FLOAT32;
52
53
#define RTI_HAVE_DOUBLE
54
typedef
double
RTI_DOUBLE64;
55
56
#if OSAPI_ENABLE_LONG_DOUBLE
57
#error "Native long double is not supported on Win32."
58
#else
59
typedef
struct
RTI_DOUBLE128
60
{
61
char
bytes[16];
62
} RTI_DOUBLE128;
63
#endif
64
65
#else
/* checks when __STDC__ is defined */
66
67
/*******************************************************************************
68
* Define/Check STDC compiler integer mappings
69
******************************************************************************/
70
#if SCHAR_MAX == 127
71
/*i
72
*/
73
typedef
signed
char
RTI_INT8;
74
75
/*i
76
*/
77
typedef
unsigned
char
RTI_UINT8;
78
#else
79
#error "SCHAR_MAX is unknown, could not determine RTI_INT8/UINT8."
80
#endif
/* SCHAR_MAX */
81
82
#if SHRT_MAX == 32767
83
/*i
84
*/
85
typedef
signed
short
RTI_INT16;
86
87
/*i
88
*/
89
typedef
unsigned
short
RTI_UINT16;
90
#else
91
#error "SHRT_MAX is unknown, could not determine RTI_INT16/UINT16."
92
#endif
/* SHRT_MAX */
93
94
#if INT_MAX == 2147483647
95
/*i
96
*/
97
typedef
signed
int
RTI_INT32;
98
99
/*i
100
*/
101
typedef
unsigned
int
RTI_UINT32;
102
#else
103
#error "INT_MAX is unknown, could not determine RTI_INT32/UINT32."
104
#endif
/* INT_MAX */
105
106
#ifdef LLONG_MAX
107
#if LLONG_MAX == 9223372036854775807LL
108
/*i
109
*/
110
typedef
signed
long
long
int
RTI_INT64;
111
112
/*i
113
*/
114
typedef
unsigned
long
long
int
RTI_UINT64;
115
#else
116
#error "LLONG_MAX is unknown, could not determine RTI_INT64/UINT64."
117
#endif
/* LLONG_MAX has unknown size */
118
#elif defined(__LONG_LONG_MAX__)
119
#if __LONG_LONG_MAX__ == 9223372036854775807LL
120
/*i
121
*/
122
typedef
signed
long
long
int
RTI_INT64;
123
124
/*i
125
*/
126
typedef
unsigned
long
long
int
RTI_UINT64;
127
#else
/* __LONG_LONG_MAX__ has unknown size */
128
#error "__LONG_LONG_MAX__ is unknown, could not determine RTI_INT64/UINT64."
129
#endif
130
#else
/* no size defined */
131
#error "Could not determine RTI_INT64/RTI_UINT64 type"
132
#endif
133
134
/*******************************************************************************
135
* Define compiler floating point mappings
136
******************************************************************************/
137
#if (__SIZEOF_FLOAT__ == 4) || (__FLT_MAX_EXP__ == 128) || (FLT_MAX_EXP == 128) || defined(__VOS__)
138
typedef
float
RTI_FLOAT32;
139
#define RTI_HAVE_FLOAT
140
#else
141
#error "__SIZEOF_FLOAT__ is unknown (GCC), could not determine RTI_FLOAT32."
142
#endif
143
144
#if (__SIZEOF_DOUBLE__ == 8) || (__DBL_MAX_EXP__ == 1024) || (DBL_MAX_EXP == 1024) || defined(__VOS__)
145
typedef
double
RTI_DOUBLE64;
146
#define RTI_HAVE_DOUBLE
147
#else
148
#error "__SIZEOF_DOUBLE__ is unknown (GCC), could not determine RTI_DOUBLE64."
149
#endif
150
151
#if OSAPI_ENABLE_LONG_DOUBLE
152
#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2))
153
typedef
__float128 RTI_DOUBLE128;
154
#define RTI_HAVE_LONG_DOUBLE
155
#else
156
#error "Could not determine if long double is supported."
157
#endif
158
#else
159
typedef
struct
RTI_DOUBLE128
160
{
161
char
bytes[16];
162
} RTI_DOUBLE128;
163
#endif
164
165
#endif
/* __STDC__ */
166
167
/*******************************************************************************
168
* Define CPU endian
169
******************************************************************************/
170
#if !defined(RTI_ENDIAN_LITTLE) && !defined(RTI_ENDIAN_BIG) && defined(__VOS__)
171
#define RTI_ENDIAN_BIG
172
#endif
173
174
#if !defined(RTI_ENDIAN_LITTLE) && !defined(RTI_ENDIAN_BIG)
175
#ifdef __GNUC__
176
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
177
defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER == __LITTLE_ENDIAN)
178
#define RTI_ENDIAN_LITTLE 1
179
#undef RTI_ENDIAN_BIG
180
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
181
defined(__BIG_ENDIAN__) || (__BYTE_ORDER == __BIG_ENDIAN)
182
#define RTI_ENDIAN_BIG 1
183
#undef RTI_ENDIAN_LITTLE
184
#else
185
#error "Unable to determine GCC byte-order"
186
#endif
/* __BYTE_ORDER__ */
187
#elif defined(_MSC_VER)
188
#if defined(_M_IX86) || defined(_M_X64)
189
#define RTI_ENDIAN_LITTLE 1
190
#undef RTI_ENDIAN_BIG
191
#else
192
#error "Unable to determine MSC byte-order"
193
#endif
194
#else
195
#error "Unable to determine endianess."
196
#endif
/* !_M_IX86 */
197
#endif
198
199
/*******************************************************************************
200
* Define various compiler compile options
201
******************************************************************************/
202
203
/* Function attributes */
204
#if defined(__GNUC__) && (__GNUC__ >= 4)
205
#define MUST_CHECK_RETURN __attribute__((warn_unused_result))
206
#define SHOULD_CHECK_RETURN
207
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
208
typedef SHOULD_CHECK_RETURN ftdef_;
209
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
210
typedef MUST_CHECK_RETURN ftdef_;
211
#elif defined(_MSC_VER) || defined(WIN32)
212
#if _MSC_VER >= 1900
213
#define MUST_CHECK_RETURN _Check_return_
214
#else
215
#include <CodeAnalysis\SourceAnnotations.h>
216
#define MUST_CHECK_RETURN [returnvalue:SA_Post(MustCheck=SA_Yes)]
217
#endif
218
#define SHOULD_CHECK_RETURN
219
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
220
typedef ftdef_;
221
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
222
typedef ftdef_;
223
#else
224
#define SHOULD_CHECK_RETURN
225
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
226
typedef ftdef_;
227
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
228
typedef ftdef_;
229
#endif
230
231
#endif
/* osapi_cc_stdc_h */
232
RTI Connext DDS Micro Version 2.4.10
Copyright © Fri Jun 30 2017
Real-Time Innovations, Inc