USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-ga1b5c4ae
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 
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 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; ignored
26 # pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
27 //# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
28 //# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated
29 # pragma warning(disable: 4250) // 'class' : inherits 'method' via dominance
30 # pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
31 
32 // define logical operators
33 #include <ciso646>
34 
35 // define ssize_t
36 #include <cstddef>
37 typedef ptrdiff_t ssize_t;
38 
39 #endif //BOOST_MSVC
40 
41 //define cross platform attribute macros
42 #if defined(BOOST_MSVC)
43  #define UHD_EXPORT __declspec(dllexport)
44  #define UHD_IMPORT __declspec(dllimport)
45  #define UHD_INLINE __forceinline
46  #define UHD_FORCE_INLINE __forceinline
47  #define UHD_DEPRECATED __declspec(deprecated)
48  #define UHD_ALIGNED(x) __declspec(align(x))
49  #define UHD_UNUSED(x) x
50 #elif defined(__MINGW32__)
51  #define UHD_EXPORT __declspec(dllexport)
52  #define UHD_IMPORT __declspec(dllimport)
53  #define UHD_INLINE inline
54  #define UHD_FORCE_INLINE inline
55  #define UHD_DEPRECATED __declspec(deprecated)
56  #define UHD_ALIGNED(x) __declspec(align(x))
57  #define UHD_UNUSED(x) x __attribute__((unused))
58 #elif defined(__GNUG__) && __GNUG__ >= 4
59  #define UHD_EXPORT __attribute__((visibility("default")))
60  #define UHD_IMPORT __attribute__((visibility("default")))
61  #define UHD_INLINE inline __attribute__((always_inline))
62  #define UHD_FORCE_INLINE inline __attribute__((always_inline))
63  #define UHD_DEPRECATED __attribute__((deprecated))
64  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
65  #define UHD_UNUSED(x) x __attribute__((unused))
66 #elif defined(__clang__)
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 #else
75  #define UHD_EXPORT
76  #define UHD_IMPORT
77  #define UHD_INLINE inline
78  #define UHD_FORCE_INLINE inline
79  #define UHD_DEPRECATED
80  #define UHD_ALIGNED(x)
81  #define UHD_UNUSED(x) x
82 #endif
83 
84 // Define API declaration macro
85 #ifdef UHD_DLL_EXPORTS
86  #define UHD_API UHD_EXPORT
87 #else
88  #define UHD_API UHD_IMPORT
89 #endif // UHD_DLL_EXPORTS
90 #ifdef UHD_RFNOC_ENABLED
91  #define UHD_RFNOC_API UHD_API
92 #else
93  #define UHD_RFNOC_API
94 #endif // UHD_RFNOC_ENABLED
95 
96 
97 // Platform defines for conditional parts of headers:
98 // Taken from boost/config/select_platform_config.hpp,
99 // however, we define macros, not strings for platforms.
100 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
101  #define UHD_PLATFORM_LINUX
102 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
103  #define UHD_PLATFORM_WIN32
104 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
105  #define UHD_PLATFORM_MACOS
106 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
107  #define UHD_PLATFORM_BSD
108 #endif
109 
110 // Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
111 // variable arguments so that it can deal with strings that contain commas.
112 // There are two different versions because MSVC handles this syntax a bit
113 // differently than other compilers.
114 #if defined(BOOST_MSVC)
115  #define XSTR(x,...) #x
116 #else
117  #define XSTR(x...) #x
118 #endif
119 
120 #define STR(x) XSTR(x)
121 
122 #endif /* INCLUDED_UHD_CONFIG_HPP */