PulseAudio  3.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, write to the Free Software
00021   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022   USA.
00023 ***/
00024 
00028 #if defined(__GNUC__)
00029 #ifdef __MINGW32__
00030 /* libintl overrides printf with a #define. As this breaks this attribute,
00031  * it has a workaround. However the workaround isn't enabled for MINGW
00032  * builds (only cygwin) */
00033 #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))
00034 #else
00035 #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
00036 #endif
00037 #else
00038 
00039 #define PA_GCC_PRINTF_ATTR(a,b)
00040 #endif
00041 
00042 #if defined(__GNUC__) && (__GNUC__ >= 4)
00043 #define PA_GCC_SENTINEL __attribute__ ((sentinel))
00044 #else
00045 
00046 #define PA_GCC_SENTINEL
00047 #endif
00048 
00049 #ifdef __GNUC__
00050 #define PA_GCC_NORETURN __attribute__((noreturn))
00051 #else
00052 
00053 #define PA_GCC_NORETURN
00054 #endif
00055 
00056 #ifdef __GNUC__
00057 #define PA_GCC_UNUSED __attribute__ ((unused))
00058 #else
00059 
00060 #define PA_GCC_UNUSED
00061 #endif
00062 
00063 #ifdef __GNUC__
00064 #define PA_GCC_DESTRUCTOR __attribute__ ((destructor))
00065 #else
00066 
00067 #define PA_GCC_DESTRUCTOR
00068 #endif
00069 
00070 #ifndef PA_GCC_PURE
00071 #ifdef __GNUC__
00072 #define PA_GCC_PURE __attribute__ ((pure))
00073 #else
00074 
00075 #define PA_GCC_PURE
00076 #endif
00077 #endif
00078 
00079 #ifndef PA_GCC_CONST
00080 #ifdef __GNUC__
00081 #define PA_GCC_CONST __attribute__ ((const))
00082 #else
00083 
00084 #define PA_GCC_CONST
00085 #endif
00086 #endif
00087 
00088 #ifndef PA_GCC_DEPRECATED
00089 #ifdef __GNUC__
00090 #define PA_GCC_DEPRECATED __attribute__ ((deprecated))
00091 #else
00092 
00093 #define PA_GCC_DEPRECATED
00094 #endif
00095 #endif
00096 
00097 #ifndef PA_GCC_PACKED
00098 #ifdef __GNUC__
00099 #define PA_GCC_PACKED __attribute__ ((packed))
00100 #else
00101 
00102 #define PA_GCC_PACKED
00103 #endif
00104 #endif
00105 
00106 #ifndef PA_GCC_ALLOC_SIZE
00107 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
00108 #define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
00109 #define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
00110 #else
00111 
00112 #define PA_GCC_ALLOC_SIZE(x)
00113 
00114 #define PA_GCC_ALLOC_SIZE2(x,y)
00115 #endif
00116 #endif
00117 
00118 #ifndef PA_GCC_MALLOC
00119 #ifdef __GNUC__
00120 #define PA_GCC_MALLOC __attribute__ ((malloc))
00121 #else
00122 
00123 #define PA_GCC_MALLOC
00124 #endif
00125 #endif
00126 
00127 #ifndef PA_GCC_WEAKREF
00128 #if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4))
00129 
00130 #define PA_GCC_WEAKREF(x) __attribute__((weakref(#x)))
00131 #endif
00132 #endif
00133 
00134 #endif