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