USRP Hardware Driver and USRP Manual  Version: 4.0.0.0-0-unknown
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 # include <cstddef>
42 typedef ptrdiff_t ssize_t;
43 
44 #endif // BOOST_MSVC
45 
46 // define cross platform attribute macros
47 #if defined(BOOST_MSVC)
48 # define UHD_EXPORT __declspec(dllexport)
49 # define UHD_IMPORT __declspec(dllimport)
50 # define UHD_INLINE __forceinline
51 # define UHD_FORCE_INLINE __forceinline
52 # define UHD_DEPRECATED __declspec(deprecated)
53 # define UHD_ALIGNED(x) __declspec(align(x))
54 # define UHD_UNUSED(x) x
55 # define UHD_FALLTHROUGH
56 #elif defined(__MINGW32__)
57 # define UHD_EXPORT __declspec(dllexport)
58 # define UHD_IMPORT __declspec(dllimport)
59 # define UHD_INLINE inline
60 # define UHD_FORCE_INLINE inline
61 # define UHD_DEPRECATED __declspec(deprecated)
62 # define UHD_ALIGNED(x) __declspec(align(x))
63 # define UHD_UNUSED(x) x __attribute__((unused))
64 # define UHD_FALLTHROUGH
65 #elif defined(__GNUG__) && __GNUG__ >= 4
66 # define UHD_EXPORT __attribute__((visibility("default")))
67 # define UHD_IMPORT __attribute__((visibility("default")))
68 # define UHD_INLINE inline __attribute__((always_inline))
69 # define UHD_FORCE_INLINE inline __attribute__((always_inline))
70 # define UHD_DEPRECATED __attribute__((deprecated))
71 # define UHD_ALIGNED(x) __attribute__((aligned(x)))
72 # define UHD_UNUSED(x) x __attribute__((unused))
73 # if __GNUG__ >= 7
74 # define UHD_FALLTHROUGH __attribute__((fallthrough));
75 # else
76 # define UHD_FALLTHROUGH
77 # endif
78 #elif defined(__clang__)
79 # define UHD_EXPORT __attribute__((visibility("default")))
80 # define UHD_IMPORT __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 #else
92 # define UHD_EXPORT
93 # define UHD_IMPORT
94 # define UHD_INLINE inline
95 # define UHD_FORCE_INLINE inline
96 # define UHD_DEPRECATED
97 # define UHD_ALIGNED(x)
98 # define UHD_UNUSED(x) x
99 # define UHD_FALLTHROUGH
100 #endif
101 
102 // Define API declaration macro
103 #ifdef UHD_STATIC_LIB
104 # define UHD_API
105 #else
106 # ifdef UHD_DLL_EXPORTS
107 # define UHD_API UHD_EXPORT
108 # else
109 # define UHD_API UHD_IMPORT
110 # endif // UHD_DLL_EXPORTS
111 #endif // UHD_STATIC_LIB
112 
113 // Platform defines for conditional parts of headers:
114 // Taken from boost/config/select_platform_config.hpp,
115 // however, we define macros, not strings for platforms.
116 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
117  && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
118 # define UHD_PLATFORM_LINUX
119 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
120 # define UHD_PLATFORM_WIN32
121 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
122 # define UHD_PLATFORM_MACOS
123 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
124  || defined(__FreeBSD_kernel__)
125 # define UHD_PLATFORM_BSD
126 #endif
127 
128 // Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
129 // variable arguments so that it can deal with strings that contain commas.
130 // There are two different versions because MSVC handles this syntax a bit
131 // differently than other compilers.
132 #if defined(BOOST_MSVC)
133 # define XSTR(x, ...) # x
134 #else
135 # define XSTR(x...) # x
136 #endif
137 
138 #define STR(x) XSTR(x)