flac: Saner EOF handling
[cmus.git] / compiler.h
blob061da77ed4362f5e19ea1d6eb7ba9a872b7515d3
1 /*
2 * Copyright 2005 Timo Hirvonen
3 */
5 #ifndef COMPILER_H
6 #define COMPILER_H
8 /*
9 * GCC 2.96 or compatible required
12 /* Optimization: Condition @x is likely */
13 #define likely(x) __builtin_expect(!!(x), 1)
15 /* Optimization: Condition @x is unlikely */
16 #define unlikely(x) __builtin_expect(!!(x), 0)
18 /* Optimization: Function never returns */
19 #define __NORETURN __attribute__((__noreturn__))
21 /* Argument at index @fmt_idx is printf compatible format string and
22 * argument at index @first_idx is the first format argument */
23 #define __FORMAT(fmt_idx, first_idx) __attribute__((format(printf, (fmt_idx), (first_idx))))
25 #if defined(__GNUC__) && (__GNUC__ >= 3)
27 /* Optimization: Pointer returned can't alias other pointers */
28 #define __MALLOC __attribute__((__malloc__))
30 #else
32 #define __MALLOC
34 #endif
36 #endif