USRP Hardware Driver and USRP Manual Version: 4.1.0.3
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#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_INLINE __forceinline
54# define UHD_FORCE_INLINE __forceinline
55# define UHD_DEPRECATED __declspec(deprecated)
56# define UHD_ALIGNED(x) __declspec(align(x))
57# define UHD_UNUSED(x) x
58# define UHD_FALLTHROUGH
59#elif defined(__MINGW32__)
60# define UHD_EXPORT __declspec(dllexport)
61# define UHD_IMPORT __declspec(dllimport)
62# define UHD_INLINE inline
63# define UHD_FORCE_INLINE inline
64# define UHD_DEPRECATED __declspec(deprecated)
65# define UHD_ALIGNED(x) __declspec(align(x))
66# define UHD_UNUSED(x) x __attribute__((unused))
67# define UHD_FALLTHROUGH
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# if __GNUG__ >= 7
77# define UHD_FALLTHROUGH __attribute__((fallthrough));
78# else
79# define UHD_FALLTHROUGH
80# endif
81#elif defined(__clang__)
82# define UHD_EXPORT __attribute__((visibility("default")))
83# define UHD_IMPORT __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# if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)
90# define UHD_FALLTHROUGH [[clang:fallthrough]];
91# else
92# define UHD_FALLTHROUGH
93# endif
94#else
95# define UHD_EXPORT
96# define UHD_IMPORT
97# define UHD_INLINE inline
98# define UHD_FORCE_INLINE inline
99# define UHD_DEPRECATED
100# define UHD_ALIGNED(x)
101# define UHD_UNUSED(x) x
102# define UHD_FALLTHROUGH
103#endif
104
105// Define API declaration macro
106#ifdef UHD_STATIC_LIB
107# define UHD_API
108#else
109# ifdef UHD_DLL_EXPORTS
110# define UHD_API UHD_EXPORT
111# else
112# define UHD_API UHD_IMPORT
113# endif // UHD_DLL_EXPORTS
114#endif // UHD_STATIC_LIB
115
116// Platform defines for conditional parts of headers:
117// Taken from boost/config/select_platform_config.hpp,
118// however, we define macros, not strings for platforms.
119#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) \
120 && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
121# define UHD_PLATFORM_LINUX
122#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
123# define UHD_PLATFORM_WIN32
124#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
125# define UHD_PLATFORM_MACOS
126#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
127 || defined(__FreeBSD_kernel__)
128# define UHD_PLATFORM_BSD
129#endif
130
131// Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
132// variable arguments so that it can deal with strings that contain commas.
133// There are two different versions because MSVC handles this syntax a bit
134// differently than other compilers.
135#if defined(BOOST_MSVC)
136# define XSTR(x, ...) # x
137#else
138# define XSTR(x...) # x
139#endif
140
141#define STR(x) XSTR(x)