Path: blob/master/thirdparty/linuxbsd_headers/pulse/gccmacro.h
9905 views
#ifndef foopulsegccmacrohfoo1#define foopulsegccmacrohfoo23/***4This file is part of PulseAudio.56Copyright 2004-2006 Lennart Poettering78PulseAudio is free software; you can redistribute it and/or modify9it under the terms of the GNU Lesser General Public License as published10by the Free Software Foundation; either version 2.1 of the License,11or (at your option) any later version.1213PulseAudio is distributed in the hope that it will be useful, but14WITHOUT ANY WARRANTY; without even the implied warranty of15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU16General Public License for more details.1718You should have received a copy of the GNU Lesser General Public License19along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.20***/2122/** \file23* GCC attribute macros */2425#if defined(__GNUC__)26#ifdef __MINGW32__27/* libintl overrides printf with a #define. As this breaks this attribute,28* it has a workaround. However the workaround isn't enabled for MINGW29* builds (only cygwin) */30#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))31#else32#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))33#endif34#else35/** If we're in GNU C, use some magic for detecting invalid format strings */36#define PA_GCC_PRINTF_ATTR(a,b)37#endif3839#if defined(__GNUC__) && (__GNUC__ >= 4)40#define PA_GCC_SENTINEL __attribute__ ((sentinel))41#else42/** Macro for usage of GCC's sentinel compilation warnings */43#define PA_GCC_SENTINEL44#endif4546#ifdef __GNUC__47#define PA_GCC_NORETURN __attribute__((noreturn))48#else49/** Macro for no-return functions */50#define PA_GCC_NORETURN51#endif5253#ifdef __GNUC__54#define PA_GCC_UNUSED __attribute__ ((unused))55#else56/** Macro for not used function, variable or parameter */57#define PA_GCC_UNUSED58#endif5960#ifdef __GNUC__61#define PA_GCC_DESTRUCTOR __attribute__ ((destructor))62#else63/** Call this function when process terminates */64#define PA_GCC_DESTRUCTOR65#endif6667#ifndef PA_GCC_PURE68#ifdef __GNUC__69#define PA_GCC_PURE __attribute__ ((pure))70#else71/** This function's return value depends only the arguments list and global state **/72#define PA_GCC_PURE73#endif74#endif7576#ifndef PA_GCC_CONST77#ifdef __GNUC__78#define PA_GCC_CONST __attribute__ ((const))79#else80/** This function's return value depends only the arguments list (stricter version of PA_GCC_PURE) **/81#define PA_GCC_CONST82#endif83#endif8485#ifndef PA_GCC_DEPRECATED86#ifdef __GNUC__87#define PA_GCC_DEPRECATED __attribute__ ((deprecated))88#else89/** This function is deprecated **/90#define PA_GCC_DEPRECATED91#endif92#endif9394#ifndef PA_GCC_PACKED95#ifdef __GNUC__96#define PA_GCC_PACKED __attribute__ ((packed))97#else98/** Structure shall be packed in memory **/99#define PA_GCC_PACKED100#endif101#endif102103#ifndef PA_GCC_ALLOC_SIZE104#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)105#define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))106#define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))107#else108/** Macro for usage of GCC's alloc_size attribute */109#define PA_GCC_ALLOC_SIZE(x)110/** Macro for usage of GCC's alloc_size attribute */111#define PA_GCC_ALLOC_SIZE2(x,y)112#endif113#endif114115#ifndef PA_GCC_MALLOC116#ifdef __GNUC__117#define PA_GCC_MALLOC __attribute__ ((malloc))118#else119/** Macro for usage of GCC's malloc attribute */120#define PA_GCC_MALLOC121#endif122#endif123124#ifndef PA_GCC_WEAKREF125#if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4))126/** Macro for usage of GCC's weakref attribute */127#define PA_GCC_WEAKREF(x) __attribute__((weakref(#x)))128#endif129#endif130131#endif132133134