[5109] | 1 | //compilerhacks.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
[5823] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2013 |
---|
[5109] | 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 | |
---|
[5359] | 32 | // just informative macros: |
---|
| 33 | #define _LIBROAR_GOOD_CAST |
---|
| 34 | #define _LIBROAR_BAD_CAST |
---|
| 35 | |
---|
[5109] | 36 | #if defined(__GNUC__) && __GNUC__ >= 4 |
---|
| 37 | #define _LIBROAR_ATTR_DEPRECATED __attribute__((deprecated)) |
---|
[5200] | 38 | #define _LIBROAR_ATTR_PURE __attribute__ ((pure)) |
---|
| 39 | #define _LIBROAR_ATTR_USE_RESULT __attribute__ ((warn_unused_result)) |
---|
[5651] | 40 | #define _LIBROAR_ATTR_PRINTF(str,args) __attribute__ ((format (printf, str, args))) |
---|
[5200] | 41 | |
---|
| 42 | // gcc does not only add a warning on NULL argument for the following |
---|
[5217] | 43 | // but also asumes they are never NULL (but allows them to be NULL) |
---|
[5200] | 44 | // and breaks our check this way. |
---|
| 45 | #if 0 |
---|
[5109] | 46 | #define _LIBROAR_ATTR_NONNULL(x, index...) __attribute__((nonnull ( x, ##index ))) |
---|
| 47 | #define _LIBROAR_ATTR_NONNULL_ALL __attribute__((nonnull)) |
---|
[5200] | 48 | #endif |
---|
[5109] | 49 | #endif |
---|
| 50 | |
---|
| 51 | // add more defintions for other compilers here. |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | #ifndef _LIBROAR_ATTR_DEPRECATED |
---|
| 56 | #define _LIBROAR_ATTR_DEPRECATED |
---|
| 57 | #endif |
---|
| 58 | #ifndef _LIBROAR_ATTR_NONNULL |
---|
| 59 | #define _LIBROAR_ATTR_NONNULL(index...) |
---|
| 60 | #endif |
---|
| 61 | #ifndef _LIBROAR_ATTR_NONNULL_ALL |
---|
| 62 | #define _LIBROAR_ATTR_NONNULL_ALL |
---|
| 63 | #endif |
---|
| 64 | #ifndef _LIBROAR_ATTR_PURE |
---|
| 65 | #define _LIBROAR_ATTR_PURE |
---|
| 66 | #endif |
---|
| 67 | #ifndef _LIBROAR_ATTR_USE_RESULT |
---|
| 68 | #define _LIBROAR_ATTR_USE_RESULT |
---|
| 69 | #endif |
---|
[5651] | 70 | #ifndef _LIBROAR_ATTR_PRINTF |
---|
| 71 | #define _LIBROAR_ATTR_PRINTF(str,args) |
---|
| 72 | #endif |
---|
[5109] | 73 | |
---|
[5111] | 74 | #ifndef _LIBROAR_IGNORE_RET |
---|
| 75 | #define _LIBROAR_IGNORE_RET(x) ((void)((x)+1)) |
---|
| 76 | #endif |
---|
| 77 | |
---|
[5109] | 78 | #ifndef _LIBROAR_NOATTR_TO_STATIC |
---|
| 79 | #define _LIBROAR_ATTR_TO_STATIC _LIBROAR_ATTR_DEPRECATED |
---|
| 80 | #else |
---|
| 81 | #define _LIBROAR_ATTR_TO_STATIC |
---|
| 82 | #endif |
---|
| 83 | |
---|
| 84 | #ifdef _LIBROAR_NOATTR_WARNINGS |
---|
| 85 | #undef _LIBROAR_ATTR_DEPRECATED |
---|
| 86 | #define _LIBROAR_ATTR_DEPRECATED |
---|
| 87 | #undef _LIBROAR_ATTR_USE_RESULT |
---|
| 88 | #define _LIBROAR_ATTR_USE_RESULT |
---|
| 89 | #endif |
---|
| 90 | |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | //ll |
---|