GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_GNURADIO_ATTRIBUTES_H
23 #define INCLUDED_GNURADIO_ATTRIBUTES_H
24 
25 ////////////////////////////////////////////////////////////////////////
26 // Cross-platform attribute macros
27 ////////////////////////////////////////////////////////////////////////
28 #if defined __GNUC__
29 # define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
30 # define __GR_ATTR_UNUSED __attribute__((unused))
31 # define __GR_ATTR_INLINE __attribute__((always_inline))
32 # define __GR_ATTR_DEPRECATED __attribute__((deprecated))
33 # if __GNUC__ >= 4
34 # define __GR_ATTR_EXPORT __attribute__((visibility("default")))
35 # define __GR_ATTR_IMPORT __attribute__((visibility("default")))
36 # else
37 # define __GR_ATTR_EXPORT
38 # define __GR_ATTR_IMPORT
39 # endif
40 #elif defined __clang__
41 # define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
42 # define __GR_ATTR_UNUSED __attribute__((unused))
43 # define __GR_ATTR_INLINE __attribute__((always_inline))
44 # define __GR_ATTR_DEPRECATED __attribute__((deprecated))
45 # define __GR_ATTR_EXPORT __attribute__((visibility("default")))
46 # define __GR_ATTR_IMPORT __attribute__((visibility("default")))
47 #elif _MSC_VER
48 # define __GR_ATTR_ALIGNED(x) __declspec(align(x))
49 # define __GR_ATTR_UNUSED
50 # define __GR_ATTR_INLINE __forceinline
51 # define __GR_ATTR_DEPRECATED __declspec(deprecated)
52 # define __GR_ATTR_EXPORT __declspec(dllexport)
53 # define __GR_ATTR_IMPORT __declspec(dllimport)
54 #else
55 # define __GR_ATTR_ALIGNED(x)
56 # define __GR_ATTR_UNUSED
57 # define __GR_ATTR_INLINE
58 # define __GR_ATTR_DEPRECATED
59 # define __GR_ATTR_EXPORT
60 # define __GR_ATTR_IMPORT
61 #endif
62 
63 ////////////////////////////////////////////////////////////////////////
64 // define inline when building C
65 ////////////////////////////////////////////////////////////////////////
66 #if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
67 # define inline __inline
68 #endif
69 
70 ////////////////////////////////////////////////////////////////////////
71 // suppress warnings
72 ////////////////////////////////////////////////////////////////////////
73 #ifdef _MSC_VER
74 # pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
75 # pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
76 # pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data
77 # pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float'
78 # pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
79 #endif
80 
81 #endif /* INCLUDED_GNURADIO_ATTRIBUTES_H */