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