YARP
Yet Another Robot Platform
system.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2019 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_CONFIG_SYSTEM_H
11 #define YARP_CONFIG_SYSTEM_H
12 
13 // System headers
14 #define YARP_HAS_EXECINFO_H
15 #define YARP_HAS_SYS_WAIT_H
16 #define YARP_HAS_SYS_TYPES_H
17 #define YARP_HAS_SYS_PRCTL_H
18 /* #undef YARP_HAS_CSIGNAL */
19 #define YARP_HAS_SIGNAL_H
20 #define YARP_HAS_SYS_SIGNAL_H
21 #define YARP_HAS_NETDB_H
22 #define YARP_HAS_DLFCN_H
23 #define YARP_HAS_IFADDRS_H
24 
25 // Size of pointers
26 #define YARP_POINTER_SIZE 8
27 
28 
30 
93 
95 
96 #if defined(_MSC_VER)
97  // see https://support.microsoft.com/kb/155196/en-us
98  #define __YARP_STR2(x) #x
99  #define __YARP_STR1(x) __YARP_STR2(x)
100  #define __YARP_LOC __FILE__ "("__STR1__(__LINE__)")"
101  #define YARP_COMPILER_MESSAGE(x) __pragma(message(__LOC__ " : msg" #x))
102  #define YARP_COMPILER_WARNING(x) __pragma(message(__LOC__ " : warning msg" #x))
103  #define YARP_COMPILER_ERROR(x) __pragma(message(__LOC__ " : error msg" #x))
104 #elif defined(__GNUC__)
105  // see https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
106  #define __YARP_DO_PRAGMA(x) _Pragma (#x)
107  #define YARP_COMPILER_MESSAGE(x) __YARP_DO_PRAGMA(message #x)
108  #define YARP_COMPILER_WARNING(x) __YARP_DO_PRAGMA(GCC warning #x)
109  #define YARP_COMPILER_ERROR(x) __YARP_DO_PRAGMA(GCC error #x)
110 #else
111  #define YARP_COMPILER_MESSAGE(x)
112  #define YARP_COMPILER_WARNING(x)
113  #define YARP_COMPILER_ERROR(x)
114 #endif
115 
116 #ifndef YARP_NO_DEPRECATED_WARNINGS
117  #define YARP_COMPILER_DEPRECATED_WARNING(x) YARP_COMPILER_WARNING(x)
118 #else
119  #define YARP_COMPILER_DEPRECATED_WARNING(x)
120 #endif
121 
122 
124 
148 
150 
151 #if defined(CYGWIN)
152 # define YARP_BEGIN_PACK \
153  _Pragma("pack(1)")
154 # define YARP_END_PACK \
155  _Pragma("pack()")
156 #elif defined(_MSC_VER)
157 // use packing and make no apologies about it
158 # define YARP_BEGIN_PACK \
159  __pragma(warning(push)) \
160  __pragma(warning(disable:4103)) \
161  __pragma(pack(push, 1))
162 # define YARP_END_PACK \
163  __pragma(pack(pop)) \
164  __pragma(warning(pop))
165 #elif defined(__linux__)
166 # define YARP_BEGIN_PACK \
167  _Pragma("pack(1)")
168 # define YARP_END_PACK _Pragma("pack()")
169 #elif defined(__DARWIN__)
170 # define YARP_BEGIN_PACK \
171  _Pragma("pack(1)")
172 # define YARP_END_PACK \
173  _Pragma("pack()")
174 #elif defined(__APPLE__)
175 # define YARP_BEGIN_PACK \
176  _Pragma("pack(1)")
177 # define YARP_END_PACK \
178  _Pragma("pack()")
179 #elif defined(__QNX4__)
180 # define YARP_BEGIN_PACK \
181  _Pragma(" pack (push) ;") \
182  _Pragma(" pack (1) ;")
183 # define YARP_END_PACK \
184  _Pragma(" pack (pop) ;")
185 #elif defined(__QNX6__)
186 //_Pragma("align 1")
187 # define YARP_BEGIN_PACK \
188  _Pragma("pack(1)")
189 //_Pragma("align 0")
190 # define YARP_END_PACK \
191  _Pragma("pack()")
192 #else
193 # define YARP_BEGIN_PACK
194 # define YARP_END_PACK
195 #endif
196 
197 
199 
304 
306 
307 #if defined(_MSC_VER)
308 # define YARP_WARNING_PUSH __pragma(warning(push))
309 # define YARP_WARNING_POP __pragma(warning(pop))
310 # define YARP_DISABLE_DEPRECATED_WARNING __pragma(warning(disable:4996))
311 # define YARP_DISABLE_DLL_INTERFACE_WARNING __pragma(warning(disable:4251))
312 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING __pragma(warning(suppress:4251))
313 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x) __pragma(warning(suppress:4251)) \
314  x
315 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...) __pragma(warning(suppress:4251)) \
316  __VA_ARGS__
317 #elif defined(__clang__)
318 # define YARP_WARNING_PUSH _Pragma("clang diagnostic push")
319 # define YARP_WARNING_POP _Pragma("clang diagnostic pop")
320 # define YARP_DISABLE_DEPRECATED_WARNING _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
321 # define YARP_DISABLE_DLL_INTERFACE_WARNING
322 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING
323 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x) x
324 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...) __VA_ARGS__
325 #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
326 # define YARP_WARNING_PUSH _Pragma("GCC diagnostic push")
327 # define YARP_WARNING_POP _Pragma("GCC diagnostic pop")
328 # define YARP_DISABLE_DEPRECATED_WARNING _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
329 # define YARP_DISABLE_DLL_INTERFACE_WARNING
330 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING
331 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x) x
332 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...) __VA_ARGS__
333 #else
334 # define YARP_WARNING_PUSH
335 # define YARP_WARNING_POP
336 # define YARP_DISABLE_DEPRECATED_WARNING
337 # define YARP_DISABLE_DLL_INTERFACE_WARNING
338 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING
339 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x) x
340 # define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...) __VA_ARGS__
341 #endif
342 
343 
344 // Bug in GCC < 6
345 // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43407
346 #if defined(__GNUC__) && (__GNUC__ < 6)
347 # define YARP_DISABLE_CLASS_ENUM_API_WARNING _Pragma("GCC diagnostic ignored \"-Wattributes\"")
348 #else
349 # define YARP_DISABLE_CLASS_ENUM_API_WARNING
350 #endif
351 
352 #endif