USRP Hardware Driver and USRP Manual  Version: 3.15.0.HEAD-0-g6563c537
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 #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 #elif defined(__GNUG__) && __GNUG__ >= 4
65 # define UHD_EXPORT __attribute__((visibility("default")))
66 # define UHD_IMPORT __attribute__((visibility("default")))
67 # define UHD_INLINE inline __attribute__((always_inline))
68 # define UHD_FORCE_INLINE inline __attribute__((always_inline))
69 # define UHD_DEPRECATED __attribute__((deprecated))
70 # define UHD_ALIGNED(x) __attribute__((aligned(x)))
71 # define UHD_UNUSED(x) x __attribute__((unused))
72 #elif defined(__clang__)
73 # define UHD_EXPORT __attribute__((visibility("default")))
74 # define UHD_IMPORT __attribute__((visibility("default")))
75 # define UHD_INLINE inline __attribute__((always_inline))
76 # define UHD_FORCE_INLINE inline __attribute__((always_inline))
77 # define UHD_DEPRECATED __attribute__((deprecated))
78 # define UHD_ALIGNED(x) __attribute__((aligned(x)))
79 # define UHD_UNUSED(x) x __attribute__((unused))
80 #else
81 # define UHD_EXPORT
82 # define UHD_IMPORT
83 # define UHD_INLINE inline
84 # define UHD_FORCE_INLINE inline
85 # define UHD_DEPRECATED
86 # define UHD_ALIGNED(x)
87 # define UHD_UNUSED(x) x
88 #endif
89 
90 // Define API declaration macro
91 #ifdef UHD_STATIC_LIB
92 # define UHD_API
93 #else
94 # ifdef UHD_DLL_EXPORTS
95 # define UHD_API UHD_EXPORT
96 # else
97 # define UHD_API UHD_IMPORT
98 # endif // UHD_DLL_EXPORTS
99 #endif // UHD_STATIC_LIB
100 
101 #ifdef UHD_RFNOC_ENABLED
102 # define UHD_RFNOC_API UHD_API
103 #else
104 # define UHD_RFNOC_API
105 #endif // UHD_RFNOC_ENABLED
106 
107 
108 // Platform defines for conditional parts of headers:
109 // Taken from boost/config/select_platform_config.hpp,
110 // however, we define macros, not strings for platforms.
111 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
112  && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
113 # define UHD_PLATFORM_LINUX
114 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
115 # define UHD_PLATFORM_WIN32
116 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
117 # define UHD_PLATFORM_MACOS
118 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
119  || defined(__FreeBSD_kernel__)
120 # define UHD_PLATFORM_BSD
121 #endif
122 
123 // Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
124 // variable arguments so that it can deal with strings that contain commas.
125 // There are two different versions because MSVC handles this syntax a bit
126 // differently than other compilers.
127 #if defined(BOOST_MSVC)
128 # define XSTR(x, ...) # x
129 #else
130 # define XSTR(x...) # x
131 #endif
132 
133 #define STR(x) XSTR(x)
134 
135 #endif /* INCLUDED_UHD_CONFIG_HPP */