RTI Connext DDS Micro
Version 2.4.9
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)
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)
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)
171
#ifdef __GNUC__
172
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
173
defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER == __LITTLE_ENDIAN)
174
#define RTI_ENDIAN_LITTLE 1
175
#undef RTI_ENDIAN_BIG
176
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
177
defined(__BIG_ENDIAN__) || (__BYTE_ORDER == __BIG_ENDIAN)
178
#define RTI_ENDIAN_BIG 1
179
#undef RTI_ENDIAN_LITTLE
180
#else
181
#error "Unable to determine GCC byte-order"
182
#endif
/* __BYTE_ORDER__ */
183
#elif defined(_MSC_VER)
184
#if defined(_M_IX86) || defined(_M_X64)
185
#define RTI_ENDIAN_LITTLE 1
186
#undef RTI_ENDIAN_BIG
187
#else
188
#error "Unable to determine MSC byte-order"
189
#endif
190
#else
191
#error "Unable to determine endianess."
192
#endif
/* !_M_IX86 */
193
#endif
194
195
/*******************************************************************************
196
* Define various compiler compile options
197
******************************************************************************/
198
199
/* Function attributes */
200
#if defined(__GNUC__) && (__GNUC__ >= 4)
201
#define MUST_CHECK_RETURN __attribute__((warn_unused_result))
202
#define SHOULD_CHECK_RETURN
203
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
204
typedef SHOULD_CHECK_RETURN ftdef_;
205
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
206
typedef MUST_CHECK_RETURN ftdef_;
207
#elif defined(_MSC_VER) || defined(WIN32)
208
#if _MSC_VER >= 1900
209
#define MUST_CHECK_RETURN _Check_return_
210
#else
211
#include <CodeAnalysis\SourceAnnotations.h>
212
#define MUST_CHECK_RETURN [returnvalue:SA_Post(MustCheck=SA_Yes)]
213
#endif
214
#define SHOULD_CHECK_RETURN
215
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
216
typedef ftdef_;
217
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
218
typedef ftdef_;
219
#else
220
#define SHOULD_CHECK_RETURN
221
#define FUNCTION_SHOULD_TYPEDEF(ftdef_) \
222
typedef ftdef_;
223
#define FUNCTION_MUST_TYPEDEF(ftdef_) \
224
typedef ftdef_;
225
#endif
226
227
#endif
/* osapi_cc_stdc_h */
228
RTI Connext DDS Micro Version 2.4.9
Copyright © Thu Dec 15 2016
Real-Time Innovations, Inc