1 #ifndef foogccmacrohfoo
2 #define foogccmacrohfoo
5 This file is part of catta.
7 catta is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
12 catta is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15 Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with catta; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 /** \file gccmacro.h Defines some macros for GCC extensions */
25 #include <catta/cdecl.h>
29 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
30 #define CATTA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
31 #define CATTA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
33 /** Macro for usage of GCC's alloc_size attribute */
34 #define CATTA_GCC_ALLOC_SIZE(x)
35 #define CATTA_GCC_ALLOC_SIZE2(x,y)
38 #if defined(__GNUC__) && (__GNUC__ >= 4)
39 #define CATTA_GCC_SENTINEL __attribute__ ((sentinel))
41 /** Macro for usage of GCC's sentinel compilation warnings */
42 #define CATTA_GCC_SENTINEL
46 #define CATTA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
48 /** Macro for usage of GCC's printf compilation warnings */
49 #define CATTA_GCC_PRINTF_ATTR(a,b)
52 /** Same as CATTA_GCC_PRINTF_ATTR but hard coded to arguments 1 and 2 */
53 #define CATTA_GCC_PRINTF_ATTR12 CATTA_GCC_PRINTF_ATTR(1,2)
55 /** Same as CATTA_GCC_PRINTF_ATTR but hard coded to arguments 2 and 3 */
56 #define CATTA_GCC_PRINTF_ATTR23 CATTA_GCC_PRINTF_ATTR(2,3)
59 #define CATTA_GCC_NORETURN __attribute__((noreturn))
61 /** Macro for no-return functions */
62 #define CATTA_GCC_NORETURN
66 #define CATTA_GCC_UNUSED __attribute__ ((unused))
68 /** Macro for not used parameter */
69 #define CATTA_GCC_UNUSED