summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/compiler.h
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/compiler.h') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/compiler.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/compiler.h b/pwmanager/pwmanager/compiler.h
new file mode 100644
index 0000000..be08c6d
--- a/dev/null
+++ b/pwmanager/pwmanager/compiler.h
@@ -0,0 +1,61 @@
1/***************************************************************************
2 * *
3 * Derived from the linux-2.6 tree *
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 version 2 *
7 * as published by the Free Software Foundation. *
8 * *
9 ***************************************************************************/
10
11#ifndef __PWMANAGER_COMPILER_H
12#define __PWMANAGER_COMPILER_H
13
14#ifdef __deprecated
15# undef __deprecated
16#endif
17#if __GNUC__ >= 3
18# if __GNUC_MINOR__ > 0
19 # define __deprecated__attribute__((deprecated))
20# endif
21#elif __GNUC__ == 2
22# if __GNUC_MINOR__ < 96
23# ifdef __builtin_expect
24# undef __builtin_expect
25# endif
26# define __builtin_expect(x, expected_value) (x)
27# endif
28#else
29# error "Sorry, your compiler is too old/not supported."
30#endif
31
32/*
33 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
34 * warning for each use, in hopes of speeding the functions removal.
35 * Usage is:
36 * int __deprecated foo(void)
37 */
38#ifndef __deprecated
39 # define __deprecated /* unimplemented */
40#endif
41
42/* define likely() and unlikely() */
43#ifdef likely
44# undef likely
45#endif
46#ifdef unlikely
47# undef unlikely
48#endif
49 #define likely(x)__builtin_expect(!!(x), 1)
50 #define unlikely(x)__builtin_expect(!!(x), 0)
51
52#ifdef NOREGPARM
53# undef NOREGPARM
54#endif
55 #define NOREGPARM__attribute__((regparm(0)))
56#ifdef REGPARM
57# undef REGPARM
58#endif
59 #define REGPARM __attribute__((regparm(3)))
60
61#endif // __PWMANAGER_COMPILER_H