USRP Hardware Driver and USRP Manual Version: 20250415.0.git50967d13.fc41
UHD and USRP Manual
 
Loading...
Searching...
No Matches
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# ifndef _SSIZE_T_DEFINED
42# define _SSIZE_T_DEFINED
43# include <BaseTsd.h>
44typedef SSIZE_T ssize_t;
45# endif /* _SSIZE_T_DEFINED */
46
47#endif // BOOST_MSVC
48
49// define cross platform attribute macros
50#if defined(BOOST_MSVC)
51# define UHD_EXPORT __declspec(dllexport)
52# define UHD_IMPORT __declspec(dllimport)
53# define UHD_EXPORT_HEADER
54# define UHD_IMPORT_HEADER
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# define UHD_FALLTHROUGH
61# define UHD_FUNCTION __FUNCTION__
62# define UHD_PRETTY_FUNCTION __FUNCSIG__
63#elif defined(__MINGW32__)
64# define UHD_EXPORT __declspec(dllexport)
65# define UHD_IMPORT __declspec(dllimport)
66# define UHD_EXPORT_HEADER
67# define UHD_IMPORT_HEADER
68# define UHD_INLINE inline
69# define UHD_FORCE_INLINE inline
70# define UHD_DEPRECATED __declspec(deprecated)
71# define UHD_ALIGNED(x) __declspec(align(x))
72# define UHD_UNUSED(x) x __attribute__((unused))
73# define UHD_FALLTHROUGH
74# define UHD_FUNCTION __func__
75# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
76#elif defined(__clang__)
77# define UHD_EXPORT __attribute__((visibility("default")))
78# define UHD_IMPORT __attribute__((visibility("default")))
79# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
80# define UHD_IMPORT_HEADER __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# define UHD_FUNCTION __func__
92# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
93# if __clang_major__ >= 10
94# define UHD_HAVE_WDEPRECATED_VOLATILE
95# endif
96#elif defined(__GNUG__) && __GNUG__ >= 4
97# define UHD_EXPORT __attribute__((visibility("default")))
98# define UHD_IMPORT __attribute__((visibility("default")))
99# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
100# define UHD_IMPORT_HEADER __attribute__((visibility("default")))
101# define UHD_INLINE inline __attribute__((always_inline))
102# define UHD_FORCE_INLINE inline __attribute__((always_inline))
103# define UHD_DEPRECATED __attribute__((deprecated))
104# define UHD_ALIGNED(x) __attribute__((aligned(x)))
105# define UHD_UNUSED(x) x __attribute__((unused))
106# if __GNUG__ >= 7
107# define UHD_FALLTHROUGH __attribute__((fallthrough));
108# else
109# define UHD_FALLTHROUGH
110# endif
111# define UHD_FUNCTION __func__
112# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
113# if __GNUG__ >= 10
114# define UHD_HAVE_WVOLATILE
115# endif
116#else
117# define UHD_EXPORT
118# define UHD_IMPORT
119# define UHD_EXPORT_HEADER
120# define UHD_IMPORT_HEADER
121# define UHD_INLINE inline
122# define UHD_FORCE_INLINE inline
123# define UHD_DEPRECATED
124# define UHD_ALIGNED(x)
125# define UHD_UNUSED(x) x
126# define UHD_FALLTHROUGH
127# define UHD_FUNCTION __func__
128# define UHD_PRETTY_FUNCTION __func__
129#endif
130
131// Define API declaration macro
132//
133// UHD_API should be used for classes/structs that
134// have a direct cpp implementations that get directly
135// built into a so/dylib/dll.
136//
137// UHD_API_HEADER should be used for classes/structs
138// that are implemented in header only like hpp/ipp.
139#ifdef UHD_STATIC_LIB
140# define UHD_API
141# define UHD_API_HEADER
142#else
143# ifdef UHD_DLL_EXPORTS
144# define UHD_API UHD_EXPORT
145# define UHD_API_HEADER UHD_EXPORT_HEADER
146# else
147# define UHD_API UHD_IMPORT
148# define UHD_API_HEADER UHD_IMPORT_HEADER
149# endif // UHD_DLL_EXPORTS
150#endif // UHD_STATIC_LIB
151
152// Platform defines for conditional parts of headers:
153// Taken from boost/config/select_platform_config.hpp,
154// however, we define macros, not strings for platforms.
155#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
156 && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
157# define UHD_PLATFORM_LINUX
158#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
159# define UHD_PLATFORM_WIN32
160#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
161# define UHD_PLATFORM_MACOS
162#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
163 || defined(__FreeBSD_kernel__)
164# define UHD_PLATFORM_BSD
165#endif
166
167// Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
168// variable arguments so that it can deal with strings that contain commas.
169// There are two different versions because MSVC handles this syntax a bit
170// differently than other compilers.
171#if defined(BOOST_MSVC)
172# define XSTR(x, ...) # x
173#else
174# define XSTR(x...) # x
175#endif
176
177#define STR(x) XSTR(x)