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