Code

screen_search.c: replaced mpd_unused by G_GNUC_UNUSED
[ncmpc.git] / src / gcc.h
1 /* the Music Player Daemon (MPD)
2  * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3  * This project's homepage is: http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
19 #ifndef MPD_GCC_H
20 #define MPD_GCC_H
22 /* this allows us to take advantage of special gcc features while still
23  * allowing other compilers to compile:
24  *
25  * example taken from: http://rlove.org/log/2005102601
26  */
28 #if defined(__GNUC__) && (__GNUC__ >= 3)
29 #  define mpd_const             __attribute__ ((const))
30 #  define mpd_deprecated        __attribute__ ((deprecated))
31 #  define mpd_malloc            __attribute__ ((malloc))
32 #  define mpd_must_check        __attribute__ ((warn_unused_result))
33 #  define mpd_noreturn          __attribute__ ((noreturn))
34 #  define mpd_packed            __attribute__ ((packed))
35 /* these are very useful for type checking */
36 #  define mpd_printf            __attribute__ ((format(printf,1,2)))
37 #  define mpd_fprintf           __attribute__ ((format(printf,2,3)))
38 #  define mpd_fprintf_          __attribute__ ((format(printf,3,4)))
39 #  define mpd_fprintf__         __attribute__ ((format(printf,4,5)))
40 #  define mpd_pure              __attribute__ ((pure))
41 #  define mpd_scanf             __attribute__ ((format(scanf,1,2)))
42 #  define mpd_unused            __attribute__ ((unused))
43 #  define mpd_used              __attribute__ ((used))
44 /* #  define inline     inline __attribute__ ((always_inline)) */
45 #  define mpd_noinline          __attribute__ ((noinline))
46 #  define mpd_likely(x)         __builtin_expect (!!(x), 1)
47 #  define mpd_unlikely(x)       __builtin_expect (!!(x), 0)
48 #else
49 #  define mpd_const
50 #  define mpd_deprecated
51 #  define mpd_malloc
52 #  define mpd_must_check
53 #  define mpd_noreturn
54 #  define mpd_packed
55 #  define mpd_printf
56 #  define mpd_fprintf
57 #  define mpd_fprintf_
58 #  define mpd_fprintf__
59 #  define mpd_pure
60 #  define mpd_scanf
61 #  define mpd_unused
62 #  define mpd_used
63 /* #  define inline */
64 #  define mpd_noinline
65 #  define mpd_likely(x)         (x)
66 #  define mpd_unlikely(x)       (x)
67 #endif
69 #endif /* MPD_GCC_H */