a08678b26b0b2e38993d3c1afdef5f0fbe155cad
[cascardo/ovs.git] / lib / compiler.h
1 /*
2  * Copyright (c) 2008, 2009 Nicira Networks.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef COMPILER_H
18 #define COMPILER_H 1
19
20 #define NO_RETURN __attribute__((__noreturn__))
21 #define UNUSED __attribute__((__unused__))
22 #define PACKED __attribute__((__packed__))
23 #define PRINTF_FORMAT(FMT, ARG1) __attribute__((__format__(printf, FMT, ARG1)))
24 #define STRFTIME_FORMAT(FMT) __attribute__((__format__(__strftime__, FMT, 0)))
25 #define MALLOC_LIKE __attribute__((__malloc__))
26 #define ALWAYS_INLINE __attribute__((always_inline))
27 #define likely(x) __builtin_expect((x),1)
28 #define unlikely(x) __builtin_expect((x),0)
29
30 #endif /* compiler.h */