| USRP Hardware Driver and Device Manual Version: 4.10.0.0 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#ifdef _MSC_VER
11
12# define UHD_MSVC _MSC_VER
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
22 // 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;
26// ignored
27# pragma warning(disable : 4275) // non dll-interface class ... used as base for
28 // dll-interface class ...
29//# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible
30// loss of data # pragma warning(disable: 4511) // 'class' : copy constructor could not be
31// generated
32# pragma warning(disable : 4250) // 'class' : inherits 'method' via dominance
33# pragma warning( \
34 disable : 4200) // nonstandard extension used : zero-sized array in struct/union
35
36// define logical operators
37# include <ciso646>
38
39// define ssize_t
40# ifndef _SSIZE_T_DEFINED
41# define _SSIZE_T_DEFINED
42# include <BaseTsd.h>
43 typedef SSIZE_T ssize_t;
44# endif /* _SSIZE_T_DEFINED */
45
46#endif // _MSC_VER
47
49//
50// \deprecated This is no longer necessary, as C and C++ now have standard
51// ways of declaring a fallthrough.
52#define UHD_FALLTHROUGH [[fallthrough]];
53
54// define cross platform attribute macros
55#if defined(UHD_MSVC)
56# define UHD_EXPORT __declspec(dllexport)
57# define UHD_IMPORT __declspec(dllimport)
58# define UHD_EXPORT_HEADER
59# define UHD_IMPORT_HEADER
60# define UHD_INLINE __forceinline
61# define UHD_FORCE_INLINE __forceinline
62# define UHD_DEPRECATED __declspec(deprecated)
63# define UHD_ALIGNED(x) __declspec(align(x))
64# define UHD_UNUSED(x) x
65# define UHD_FUNCTION __FUNCTION__
66# define UHD_PRETTY_FUNCTION __FUNCSIG__
67#elif defined(__MINGW32__)
68# define UHD_EXPORT __declspec(dllexport)
69# define UHD_IMPORT __declspec(dllimport)
70# define UHD_EXPORT_HEADER
71# define UHD_IMPORT_HEADER
72# define UHD_INLINE inline
73# define UHD_FORCE_INLINE inline
74# define UHD_DEPRECATED __declspec(deprecated)
75# define UHD_ALIGNED(x) __declspec(align(x))
76# define UHD_UNUSED(x) x __attribute__((unused))
77# define UHD_FUNCTION __func__
78# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
79#elif defined(__clang__)
80# define UHD_EXPORT __attribute__((visibility("default")))
81# define UHD_IMPORT __attribute__((visibility("default")))
82# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
83# define UHD_IMPORT_HEADER __attribute__((visibility("default")))
84# define UHD_INLINE inline __attribute__((always_inline))
85# define UHD_FORCE_INLINE inline __attribute__((always_inline))
86# define UHD_DEPRECATED __attribute__((deprecated))
87# define UHD_ALIGNED(x) __attribute__((aligned(x)))
88# define UHD_UNUSED(x) x __attribute__((unused))
89# define UHD_FUNCTION __func__
90# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
91# if __clang_major__ >= 10
92# define UHD_HAVE_WDEPRECATED_VOLATILE
93# endif
94#elif defined(__GNUG__) && __GNUG__ >= 4
95# define UHD_EXPORT __attribute__((visibility("default")))
96# define UHD_IMPORT __attribute__((visibility("default")))
97# define UHD_EXPORT_HEADER __attribute__((visibility("default")))
98# define UHD_IMPORT_HEADER __attribute__((visibility("default")))
99# define UHD_INLINE inline __attribute__((always_inline))
100# define UHD_FORCE_INLINE inline __attribute__((always_inline))
101# define UHD_DEPRECATED __attribute__((deprecated))
102# define UHD_ALIGNED(x) __attribute__((aligned(x)))
103# define UHD_UNUSED(x) x __attribute__((unused))
104# define UHD_FUNCTION __func__
105# define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__
106# if __GNUG__ >= 10
107# define UHD_HAVE_WVOLATILE
108# endif
109#else
110# define UHD_EXPORT
111# define UHD_IMPORT
112# define UHD_EXPORT_HEADER
113# define UHD_IMPORT_HEADER
114# define UHD_INLINE inline
115# define UHD_FORCE_INLINE inline
116# define UHD_DEPRECATED
117# define UHD_ALIGNED(x)
118# define UHD_UNUSED(x) x
119# define UHD_FUNCTION __func__
120# define UHD_PRETTY_FUNCTION __func__
121#endif
122
123// Define API declaration macro
124//
125// UHD_API should be used for classes/structs that
126// have a direct cpp implementations that get directly
127// built into a so/dylib/dll.
128//
129// UHD_API_HEADER should be used for classes/structs
130// that are implemented in header only like hpp/ipp.
131#ifdef UHD_STATIC_LIB
132# define UHD_API
133# define UHD_API_HEADER
134#else
135# ifdef UHD_DLL_EXPORTS
136# define UHD_API UHD_EXPORT
137# define UHD_API_HEADER UHD_EXPORT_HEADER
138# else
139# define UHD_API UHD_IMPORT
140# define UHD_API_HEADER UHD_IMPORT_HEADER
141# endif // UHD_DLL_EXPORTS
142#endif // UHD_STATIC_LIB
143
144// Platform defines for conditional parts of headers:
145// Taken from boost/config/select_platform_config.hpp,
146// however, we define macros, not strings for platforms.
147#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
148 && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
149# define UHD_PLATFORM_LINUX
150#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
151# define UHD_PLATFORM_WIN32
152#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
153# define UHD_PLATFORM_MACOS
154#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
155 || defined(__FreeBSD_kernel__)
156# define UHD_PLATFORM_BSD
157#endif
158
159// Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
160// variable arguments so that it can deal with strings that contain commas.
161// There are two different versions because MSVC handles this syntax a bit
162// differently than other compilers.
163#if defined(UHD_MSVC)
164# define XSTR(x, ...) # x
165#else
166# define XSTR(x...) # x
167#endif
168
169#define STR(x) XSTR(x)