USRP Hardware Driver and USRP Manual  Version: 003.010.003.HEAD-0-gef157678
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 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_CONFIG_HPP
19 #define INCLUDED_UHD_CONFIG_HPP
20 
21 #include <boost/config.hpp>
22 
23 #ifdef BOOST_MSVC
24 // suppress warnings
25 //# pragma warning(push)
26 //# pragma warning(disable: 4511) // copy constructor can't not be generated
27 //# pragma warning(disable: 4512) // assignment operator can't not be generated
28 //# pragma warning(disable: 4100) // unreferenced formal parameter
29 //# pragma warning(disable: 4996) // <symbol> was declared deprecated
30 # pragma warning(disable: 4355) // 'this' : used in base member initializer list
31 //# pragma warning(disable: 4706) // assignment within conditional expression
32 # pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
33 //# pragma warning(disable: 4127) // conditional expression is constant
34 //# pragma warning(disable: 4290) // C++ exception specification ignored except to ...
35 //# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
36 # pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
37 //# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
38 //# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated
39 # pragma warning(disable: 4250) // 'class' : inherits 'method' via dominance
40 # pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
41 
42 // define logical operators
43 #include <ciso646>
44 
45 // define ssize_t
46 #include <cstddef>
47 typedef ptrdiff_t ssize_t;
48 
49 #endif //BOOST_MSVC
50 
51 //define cross platform attribute macros
52 #if defined(BOOST_MSVC)
53  #define UHD_EXPORT __declspec(dllexport)
54  #define UHD_IMPORT __declspec(dllimport)
55  #define UHD_INLINE __forceinline
56  #define UHD_FORCE_INLINE __forceinline
57  #define UHD_DEPRECATED __declspec(deprecated)
58  #define UHD_ALIGNED(x) __declspec(align(x))
59  #define UHD_UNUSED(x) x
60 #elif defined(__MINGW32__)
61  #define UHD_EXPORT __declspec(dllexport)
62  #define UHD_IMPORT __declspec(dllimport)
63  #define UHD_INLINE inline
64  #define UHD_FORCE_INLINE inline
65  #define UHD_DEPRECATED __declspec(deprecated)
66  #define UHD_ALIGNED(x) __declspec(align(x))
67  #define UHD_UNUSED(x) x __attribute__((unused))
68 #elif defined(__GNUG__) && __GNUG__ >= 4
69  #define UHD_EXPORT __attribute__((visibility("default")))
70  #define UHD_IMPORT __attribute__((visibility("default")))
71  #define UHD_INLINE inline __attribute__((always_inline))
72  #define UHD_FORCE_INLINE inline __attribute__((always_inline))
73  #define UHD_DEPRECATED __attribute__((deprecated))
74  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
75  #define UHD_UNUSED(x) x __attribute__((unused))
76 #elif defined(__clang__)
77  #define UHD_EXPORT __attribute__((visibility("default")))
78  #define UHD_IMPORT __attribute__((visibility("default")))
79  #define UHD_INLINE inline __attribute__((always_inline))
80  #define UHD_FORCE_INLINE inline __attribute__((always_inline))
81  #define UHD_DEPRECATED __attribute__((deprecated))
82  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
83  #define UHD_UNUSED(x) x __attribute__((unused))
84 #else
85  #define UHD_EXPORT
86  #define UHD_IMPORT
87  #define UHD_INLINE inline
88  #define UHD_FORCE_INLINE inline
89  #define UHD_DEPRECATED
90  #define UHD_ALIGNED(x)
91  #define UHD_UNUSED(x) x
92 #endif
93 
94 // Define API declaration macro
95 #ifdef UHD_DLL_EXPORTS
96  #define UHD_API UHD_EXPORT
97 #else
98  #define UHD_API UHD_IMPORT
99 #endif // UHD_DLL_EXPORTS
100 #ifdef UHD_RFNOC_ENABLED
101  #define UHD_RFNOC_API UHD_API
102 #else
103  #define UHD_RFNOC_API
104 #endif // UHD_RFNOC_ENABLED
105 
106 
107 // Platform defines for conditional parts of headers:
108 // Taken from boost/config/select_platform_config.hpp,
109 // however, we define macros, not strings for platforms.
110 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
111  #define UHD_PLATFORM_LINUX
112 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
113  #define UHD_PLATFORM_WIN32
114 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
115  #define UHD_PLATFORM_MACOS
116 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
117  #define UHD_PLATFORM_BSD
118 #endif
119 
120 // Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
121 // variable arguments so that it can deal with strings that contain commas.
122 // There are two different versions because MSVC handles this syntax a bit
123 // differently than other compilers.
124 #if defined(BOOST_MSVC)
125  #define XSTR(x,...) #x
126 #else
127  #define XSTR(x...) #x
128 #endif
129 
130 #define STR(x) XSTR(x)
131 
132 #endif /* INCLUDED_UHD_CONFIG_HPP */