blob: e3afbff2c2028d637f469d272c6f552275f0e0b2 [file] [log] [blame]
Jacob Erlbeck6b262182013-08-14 12:26:27 +02001#ifndef OSMOCORE_DEFS_H
2#define OSMOCORE_DEFS_H
3
4/*! \defgroup utils General-purpose utility functions
5 * @{
6 */
7
8/*! \file defs.h
9 * \brief General definitions that are meant to be included from header files.
10 */
11
12/*! \brief Check for gcc and version.
13 *
14 * \note Albeit glibc provides a features.h file that contains a similar
15 * definition (__GNUC_PREREQ), this definition has been copied from there
16 * to have it available with other libraries, too.
17 *
18 * \return != 0 iff gcc is used and it's version is at least maj.min.
19 */
20#if defined __GNUC__ && defined __GNUC_MINOR__
21# define OSMO_GNUC_PREREQ(maj, min) \
22 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
23#else
24# define OSMO_GNUC_PREREQ(maj, min) 0
25#endif
26
27/*! \brief Set the deprecated attribute with a message.
28 */
29#if ! defined(__GNUC__)
30# define OSMO_DEPRECATED(text)
31#elif OSMO_GNUC_PREREQ(4,5)
32# define OSMO_DEPRECATED(text) __attribute__((__deprecated__(text)))
33#else
34# define OSMO_DEPRECATED(text) __attribute__((__deprecated__))
35#endif
36
37/*! @} */
38
39#endif