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