PulseAudio  9.0
gccmacro.h
Go to the documentation of this file.
00001 #ifndef foopulsegccmacrohfoo
00002 #define foopulsegccmacrohfoo
00003 
00004 /***
00005   This file is part of PulseAudio.
00006 
00007   Copyright 2004-2006 Lennart Poettering
00008 
00009   PulseAudio is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU Lesser General Public License as published
00011   by the Free Software Foundation; either version 2.1 of the License,
00012   or (at your option) any later version.
00013 
00014   PulseAudio is distributed in the hope that it will be useful, but
00015   WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017   General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public License
00020   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
00021 ***/
00022 
00026 #if defined(__GNUC__)
00027 #ifdef __MINGW32__
00028 /* libintl overrides printf with a #define. As this breaks this attribute,
00029  * it has a workaround. However the workaround isn't enabled for MINGW
00030  * builds (only cygwin) */
00031 #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))
00032 #else
00033 #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
00034 #endif
00035 #else
00036 
00037 #define PA_GCC_PRINTF_ATTR(a,b)
00038 #endif
00039 
00040 #if defined(__GNUC__) && (__GNUC__ >= 4)
00041 #define PA_GCC_SENTINEL __attribute__ ((sentinel))
00042 #else
00043 
00044 #define PA_GCC_SENTINEL
00045 #endif
00046 
00047 #ifdef __GNUC__
00048 #define PA_GCC_NORETURN __attribute__((noreturn))
00049 #else
00050 
00051 #define PA_GCC_NORETURN
00052 #endif
00053 
00054 #ifdef __GNUC__
00055 #define PA_GCC_UNUSED __attribute__ ((unused))
00056 #else
00057 
00058 #define PA_GCC_UNUSED
00059 #endif
00060 
00061 #ifdef __GNUC__
00062 #define PA_GCC_DESTRUCTOR __attribute__ ((destructor))
00063 #else
00064 
00065 #define PA_GCC_DESTRUCTOR
00066 #endif
00067 
00068 #ifndef PA_GCC_PURE
00069 #ifdef __GNUC__
00070 #define PA_GCC_PURE __attribute__ ((pure))
00071 #else
00072 
00073 #define PA_GCC_PURE
00074 #endif
00075 #endif
00076 
00077 #ifndef PA_GCC_CONST
00078 #ifdef __GNUC__
00079 #define PA_GCC_CONST __attribute__ ((const))
00080 #else
00081 
00082 #define PA_GCC_CONST
00083 #endif
00084 #endif
00085 
00086 #ifndef PA_GCC_DEPRECATED
00087 #ifdef __GNUC__
00088 #define PA_GCC_DEPRECATED __attribute__ ((deprecated))
00089 #else
00090 
00091 #define PA_GCC_DEPRECATED
00092 #endif
00093 #endif
00094 
00095 #ifndef PA_GCC_PACKED
00096 #ifdef __GNUC__
00097 #define PA_GCC_PACKED __attribute__ ((packed))
00098 #else
00099 
00100 #define PA_GCC_PACKED
00101 #endif
00102 #endif
00103 
00104 #ifndef PA_GCC_ALLOC_SIZE
00105 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
00106 #define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
00107 #define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
00108 #else
00109 
00110 #define PA_GCC_ALLOC_SIZE(x)
00111 
00112 #define PA_GCC_ALLOC_SIZE2(x,y)
00113 #endif
00114 #endif
00115 
00116 #ifndef PA_GCC_MALLOC
00117 #ifdef __GNUC__
00118 #define PA_GCC_MALLOC __attribute__ ((malloc))
00119 #else
00120 
00121 #define PA_GCC_MALLOC
00122 #endif
00123 #endif
00124 
00125 #ifndef PA_GCC_WEAKREF
00126 #if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4))
00127 
00128 #define PA_GCC_WEAKREF(x) __attribute__((weakref(#x)))
00129 #endif
00130 #endif
00131 
00132 #endif