GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
attributes.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * SPDX-License-Identifier: GPL-3.0-or-later
7  *
8  */
9 
10 #ifndef INCLUDED_GNURADIO_ATTRIBUTES_H
11 #define INCLUDED_GNURADIO_ATTRIBUTES_H
12 
13 ////////////////////////////////////////////////////////////////////////
14 // Cross-platform attribute macros
15 ////////////////////////////////////////////////////////////////////////
16 #if defined(__clang__) && (!defined(_MSC_VER))
17 // AppleClang also defines __GNUC__, so do this check first. These
18 // will probably be the same as for __GNUC__, but let's keep them
19 // separate just to be safe.
20 #define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
21 #define __GR_ATTR_UNUSED __attribute__((unused))
22 #define __GR_ATTR_INLINE __attribute__((always_inline))
23 #define __GR_ATTR_DEPRECATED __attribute__((deprecated))
24 #define __GR_ATTR_EXPORT __attribute__((visibility("default")))
25 #define __GR_ATTR_IMPORT __attribute__((visibility("default")))
26 #elif defined __GNUC__
27 #define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
28 #define __GR_ATTR_UNUSED __attribute__((unused))
29 #define __GR_ATTR_INLINE __attribute__((always_inline))
30 #define __GR_ATTR_DEPRECATED __attribute__((deprecated))
31 #define __GR_ATTR_EXPORT __attribute__((visibility("default")))
32 #define __GR_ATTR_IMPORT __attribute__((visibility("default")))
33 #elif _MSC_VER
34 #define __GR_ATTR_ALIGNED(x) __declspec(align(x))
35 #define __GR_ATTR_UNUSED
36 #define __GR_ATTR_INLINE __forceinline
37 #define __GR_ATTR_DEPRECATED __declspec(deprecated)
38 #define __GR_ATTR_EXPORT __declspec(dllexport)
39 #define __GR_ATTR_IMPORT __declspec(dllimport)
40 #else
41 #define __GR_ATTR_ALIGNED(x)
42 #define __GR_ATTR_UNUSED
43 #define __GR_ATTR_INLINE
44 #define __GR_ATTR_DEPRECATED
45 #define __GR_ATTR_EXPORT
46 #define __GR_ATTR_IMPORT
47 #endif
48 
49 ////////////////////////////////////////////////////////////////////////
50 // define inline when building C
51 ////////////////////////////////////////////////////////////////////////
52 #if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
53 #define inline __inline
54 #endif
55 
56 ////////////////////////////////////////////////////////////////////////
57 // suppress warnings
58 ////////////////////////////////////////////////////////////////////////
59 #ifdef _MSC_VER
60 #pragma warning(disable : 4251) // class 'A<T>' needs to have dll-interface to be used by
61  // clients of class 'B'
62 #pragma warning(disable : 4275) // non dll-interface class ... used as base for
63  // dll-interface class ...
64 #pragma warning( \
65  disable : 4244) // conversion from 'double' to 'float', possible loss of data
66 #pragma warning(disable : 4305) // 'initializing' : truncation from 'double' to 'float'
67 #pragma warning(disable : 4290) // C++ exception specification ignored except to indicate
68  // a function is not __declspec(nothrow)
69 #endif
70 #endif /* INCLUDED_GNURADIO_ATTRIBUTES_H */