GNU Radio 3.7.3 C++ API
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 _MSC_VER
41 # define __GR_ATTR_ALIGNED(x) __declspec(align(x))
42 # define __GR_ATTR_UNUSED
43 # define __GR_ATTR_INLINE __forceinline
44 # define __GR_ATTR_DEPRECATED __declspec(deprecated)
45 # define __GR_ATTR_EXPORT __declspec(dllexport)
46 # define __GR_ATTR_IMPORT __declspec(dllimport)
47 #else
48 # define __GR_ATTR_ALIGNED(x)
49 # define __GR_ATTR_UNUSED
50 # define __GR_ATTR_INLINE
51 # define __GR_ATTR_DEPRECATED
52 # define __GR_ATTR_EXPORT
53 # define __GR_ATTR_IMPORT
54 #endif
55 
56 ////////////////////////////////////////////////////////////////////////
57 // define inline when building C
58 ////////////////////////////////////////////////////////////////////////
59 #if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
60 # define inline __inline
61 #endif
62 
63 ////////////////////////////////////////////////////////////////////////
64 // suppress warnings
65 ////////////////////////////////////////////////////////////////////////
66 #ifdef _MSC_VER
67 # pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
68 # pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
69 # pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data
70 # pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float'
71 # pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
72 #endif
73 
74 #endif /* INCLUDED_GNURADIO_ATTRIBUTES_H */