MPD 0.17~git
|
00001 /* 00002 * Copyright (C) 2003-2011 The Music Player Daemon Project 00003 * http://www.musicpd.org 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #ifndef MPD_GCC_H 00021 #define MPD_GCC_H 00022 00023 #define GCC_CHECK_VERSION(major, minor) \ 00024 (defined(__GNUC__) && \ 00025 (__GNUC__ > (major) || \ 00026 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) 00027 00028 /* this allows us to take advantage of special gcc features while still 00029 * allowing other compilers to compile: 00030 * 00031 * example taken from: http://rlove.org/log/2005102601 00032 */ 00033 00034 #if GCC_CHECK_VERSION(3,0) 00035 # define gcc_must_check __attribute__ ((warn_unused_result)) 00036 # define gcc_packed __attribute__ ((packed)) 00037 /* these are very useful for type checking */ 00038 # define gcc_printf __attribute__ ((format(printf,1,2))) 00039 # define gcc_fprintf __attribute__ ((format(printf,2,3))) 00040 # define gcc_fprintf_ __attribute__ ((format(printf,3,4))) 00041 # define gcc_fprintf__ __attribute__ ((format(printf,4,5))) 00042 # define gcc_scanf __attribute__ ((format(scanf,1,2))) 00043 # define gcc_used __attribute__ ((used)) 00044 /* # define inline inline __attribute__ ((always_inline)) */ 00045 # define gcc_noinline __attribute__ ((noinline)) 00046 # define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) 00047 # define gcc_nonnull_all __attribute__((nonnull)) 00048 #else 00049 # define gcc_must_check 00050 # define gcc_packed 00051 # define gcc_printf 00052 # define gcc_fprintf 00053 # define gcc_fprintf_ 00054 # define gcc_fprintf__ 00055 # define gcc_scanf 00056 # define gcc_used 00057 /* # define inline */ 00058 # define gcc_noinline 00059 # define gcc_nonnull(...) 00060 # define gcc_nonnull_all 00061 #endif 00062 00063 #endif /* MPD_GCC_H */