GNU Radio's GSM Package
defs.h
Go to the documentation of this file.
1 /*! \file defs.h
2  * General definitions that are meant to be included from header files.
3  */
4 
5 #pragma once
6 
7 /*! \defgroup utils General-purpose utility functions
8  * @{
9  * \file defs.h */
10 
11 /*! Check for gcc and version.
12  *
13  * \note Albeit glibc provides a features.h file that contains a similar
14  * definition (__GNUC_PREREQ), this definition has been copied from there
15  * to have it available with other libraries, too.
16  *
17  * \return != 0 iff gcc is used and it's version is at least maj.min.
18  */
19 #if defined __GNUC__ && defined __GNUC_MINOR__
20 # define OSMO_GNUC_PREREQ(maj, min) \
21  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
22 #else
23 # define OSMO_GNUC_PREREQ(maj, min) 0
24 #endif
25 
26 /*! Set the deprecated attribute with a message.
27  */
28 #if defined(__clang__)
29 # define _OSMO_HAS_ATTRIBUTE_DEPRECATED __has_attribute(deprecated)
30 # define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE __has_extension(attribute_deprecated_with_message)
31 #elif defined(__GNUC__)
32 # define _OSMO_HAS_ATTRIBUTE_DEPRECATED 1
33 # define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE OSMO_GNUC_PREREQ(4,5)
34 #endif
35 
36 #if _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE
37 # define OSMO_DEPRECATED(text) __attribute__((__deprecated__(text)))
38 #elif _OSMO_HAS_ATTRIBUTE_DEPRECATED
39 # define OSMO_DEPRECATED(text) __attribute__((__deprecated__))
40 #else
41 # define OSMO_DEPRECATED(text)
42 #endif
43 
44 #if BUILDING_LIBOSMOCORE
45 # define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
46 #else
47 # define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE OSMO_DEPRECATED("For internal use inside libosmocore only.")
48 #endif
49 
50 #undef _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE
51 #undef _OSMO_HAS_ATTRIBUTE_DEPRECATED
52 
53 /*! @} */