source: roaraudio/include/roaraudio/compilerhacks.h @ 5381:430b1d26e12d

Last change on this file since 5381:430b1d26e12d was 5381:430b1d26e12d, checked in by phi, 12 years ago

updated copyright years

File size: 2.6 KB
Line 
1//compilerhacks.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
5 *
6 *  This file is part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU Lesser General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU Lesser General Public License for more details.
18 *
19 *  You should have received a copy of the GNU Lesser General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 *  NOTE: Even though this file is LGPLed it (may) include GPLed files
25 *  so the license of this file is/may therefore downgraded to GPL.
26 *  See HACKING for details.
27 */
28
29#ifndef _ROARAUDIO_COMPILERHACKS_H_
30#define _ROARAUDIO_COMPILERHACKS_H_
31
32// just informative macros:
33#define _LIBROAR_GOOD_CAST
34#define _LIBROAR_BAD_CAST
35
36#if defined(__GNUC__) && __GNUC__ >= 4
37#define _LIBROAR_ATTR_DEPRECATED        __attribute__((deprecated))
38#define _LIBROAR_ATTR_PURE              __attribute__ ((pure))
39#define _LIBROAR_ATTR_USE_RESULT        __attribute__ ((warn_unused_result))
40
41// gcc does not only add a warning on NULL argument for the following
42// but also asumes they are never NULL (but allows them to be NULL)
43// and breaks our check this way.
44#if 0
45#define _LIBROAR_ATTR_NONNULL(x, index...) __attribute__((nonnull ( x, ##index )))
46#define _LIBROAR_ATTR_NONNULL_ALL       __attribute__((nonnull))
47#endif
48#endif
49
50// add more defintions for other compilers here.
51
52
53
54#ifndef _LIBROAR_ATTR_DEPRECATED
55#define _LIBROAR_ATTR_DEPRECATED
56#endif
57#ifndef _LIBROAR_ATTR_NONNULL
58#define _LIBROAR_ATTR_NONNULL(index...)
59#endif
60#ifndef _LIBROAR_ATTR_NONNULL_ALL
61#define _LIBROAR_ATTR_NONNULL_ALL
62#endif
63#ifndef _LIBROAR_ATTR_PURE
64#define _LIBROAR_ATTR_PURE
65#endif
66#ifndef _LIBROAR_ATTR_USE_RESULT
67#define _LIBROAR_ATTR_USE_RESULT
68#endif
69
70#ifndef _LIBROAR_IGNORE_RET
71#define _LIBROAR_IGNORE_RET(x) ((void)((x)+1))
72#endif
73
74#ifndef _LIBROAR_NOATTR_TO_STATIC
75#define _LIBROAR_ATTR_TO_STATIC _LIBROAR_ATTR_DEPRECATED
76#else
77#define _LIBROAR_ATTR_TO_STATIC
78#endif
79
80#ifdef _LIBROAR_NOATTR_WARNINGS
81#undef _LIBROAR_ATTR_DEPRECATED
82#define _LIBROAR_ATTR_DEPRECATED
83#undef _LIBROAR_ATTR_USE_RESULT
84#define _LIBROAR_ATTR_USE_RESULT
85#endif
86
87#endif
88
89//ll
Note: See TracBrowser for help on using the repository browser.