USRP Hardware Driver and USRP Manual  Version: 3.15.0.HEAD-0-gaea0e2de
UHD and USRP Manual
config.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011,2014-2016 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #ifndef INCLUDED_UHD_CONFIG_HPP
9 #define INCLUDED_UHD_CONFIG_HPP
10 
11 #include <boost/config.hpp>
12 #include <boost/version.hpp>
13 
14 #ifdef BOOST_MSVC
15 // suppress warnings
16 //# pragma warning(push)
17 //# pragma warning(disable: 4511) // copy constructor can't not be generated
18 //# pragma warning(disable: 4512) // assignment operator can't not be generated
19 //# pragma warning(disable: 4100) // unreferenced formal parameter
20 //# pragma warning(disable: 4996) // <symbol> was declared deprecated
21 # pragma warning(disable : 4355) // 'this' : used in base member initializer list
22 //# pragma warning(disable: 4706) // assignment within conditional expression
23 # pragma warning(disable : 4251) // class 'A<T>' needs to have dll-interface to be used
24  // by clients of class 'B'
25 //# pragma warning(disable: 4127) // conditional expression is constant
26 //# pragma warning(disable: 4290) // C++ exception specification ignored except to ...
27 //# pragma warning(disable: 4180) // qualifier applied to function type has no meaning;
28 // ignored
29 # pragma warning(disable : 4275) // non dll-interface class ... used as base for
30  // dll-interface class ...
31 //# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible
32 // loss of data # pragma warning(disable: 4511) // 'class' : copy constructor could not be
33 // generated
34 # pragma warning(disable : 4250) // 'class' : inherits 'method' via dominance
35 # pragma warning( \
36  disable : 4200) // nonstandard extension used : zero-sized array in struct/union
37 
38 // define logical operators
39 # include <ciso646>
40 
41 // define ssize_t
42 # include <cstddef>
43 typedef ptrdiff_t ssize_t;
44 
45 #endif // BOOST_MSVC
46 
47 // define cross platform attribute macros
48 #if defined(BOOST_MSVC)
49 # define UHD_EXPORT __declspec(dllexport)
50 # define UHD_IMPORT __declspec(dllimport)
51 # define UHD_INLINE __forceinline
52 # define UHD_FORCE_INLINE __forceinline
53 # define UHD_DEPRECATED __declspec(deprecated)
54 # define UHD_ALIGNED(x) __declspec(align(x))
55 # define UHD_UNUSED(x) x
56 # define UHD_FALLTHROUGH
57 #elif defined(__MINGW32__)
58 # define UHD_EXPORT __declspec(dllexport)
59 # define UHD_IMPORT __declspec(dllimport)
60 # define UHD_INLINE inline
61 # define UHD_FORCE_INLINE inline
62 # define UHD_DEPRECATED __declspec(deprecated)
63 # define UHD_ALIGNED(x) __declspec(align(x))
64 # define UHD_UNUSED(x) x __attribute__((unused))
65 # define UHD_FALLTHROUGH
66 #elif defined(__GNUG__) && __GNUG__ >= 4
67 # define UHD_EXPORT __attribute__((visibility("default")))
68 # define UHD_IMPORT __attribute__((visibility("default")))
69 # define UHD_INLINE inline __attribute__((always_inline))
70 # define UHD_FORCE_INLINE inline __attribute__((always_inline))
71 # define UHD_DEPRECATED __attribute__((deprecated))
72 # define UHD_ALIGNED(x) __attribute__((aligned(x)))
73 # define UHD_UNUSED(x) x __attribute__((unused))
74 # if __GNUG__ >= 7
75 # define UHD_FALLTHROUGH __attribute__((fallthrough));
76 # else
77 # define UHD_FALLTHROUGH
78 # endif
79 #elif defined(__clang__)
80 # define UHD_EXPORT __attribute__((visibility("default")))
81 # define UHD_IMPORT __attribute__((visibility("default")))
82 # define UHD_INLINE inline __attribute__((always_inline))
83 # define UHD_FORCE_INLINE inline __attribute__((always_inline))
84 # define UHD_DEPRECATED __attribute__((deprecated))
85 # define UHD_ALIGNED(x) __attribute__((aligned(x)))
86 # define UHD_UNUSED(x) x __attribute__((unused))
87 # if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)
88 # define UHD_FALLTHROUGH [[clang:fallthrough]]
89 # else
90 # define UHD_FALLTHROUGH
91 # endif
92 #else
93 # define UHD_EXPORT
94 # define UHD_IMPORT
95 # define UHD_INLINE inline
96 # define UHD_FORCE_INLINE inline
97 # define UHD_DEPRECATED
98 # define UHD_ALIGNED(x)
99 # define UHD_UNUSED(x) x
100 # define UHD_FALLTHROUGH
101 #endif
102 
103 // Define API declaration macro
104 #ifdef UHD_STATIC_LIB
105 # define UHD_API
106 #else
107 # ifdef UHD_DLL_EXPORTS
108 # define UHD_API UHD_EXPORT
109 # else
110 # define UHD_API UHD_IMPORT
111 # endif // UHD_DLL_EXPORTS
112 #endif // UHD_STATIC_LIB
113 
114 #ifdef UHD_RFNOC_ENABLED
115 # define UHD_RFNOC_API UHD_API
116 #else
117 # define UHD_RFNOC_API
118 #endif // UHD_RFNOC_ENABLED
119 
120 
121 // Platform defines for conditional parts of headers:
122 // Taken from boost/config/select_platform_config.hpp,
123 // however, we define macros, not strings for platforms.
124 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
125  && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
126 # define UHD_PLATFORM_LINUX
127 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
128 # define UHD_PLATFORM_WIN32
129 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
130 # define UHD_PLATFORM_MACOS
131 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
132  || defined(__FreeBSD_kernel__)
133 # define UHD_PLATFORM_BSD
134 #endif
135 
136 // Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
137 // variable arguments so that it can deal with strings that contain commas.
138 // There are two different versions because MSVC handles this syntax a bit
139 // differently than other compilers.
140 #if defined(BOOST_MSVC)
141 # define XSTR(x, ...) # x
142 #else
143 # define XSTR(x...) # x
144 #endif
145 
146 #define STR(x) XSTR(x)
147 
148 #endif /* INCLUDED_UHD_CONFIG_HPP */