summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/compiler.h
authorulf69 <ulf69>2004-09-15 17:53:22 (UTC)
committer ulf69 <ulf69>2004-09-15 17:53:22 (UTC)
commitd3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (side-by-side diff)
tree60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/compiler.h
parentce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff)
downloadkdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz
kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2
initial revision
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 @@
+/***************************************************************************
+ * *
+ * Derived from the linux-2.6 tree *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License version 2 *
+ * as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+#ifndef __PWMANAGER_COMPILER_H
+#define __PWMANAGER_COMPILER_H
+
+#ifdef __deprecated
+# undef __deprecated
+#endif
+#if __GNUC__ >= 3
+# if __GNUC_MINOR__ > 0
+# define __deprecated __attribute__((deprecated))
+# endif
+#elif __GNUC__ == 2
+# if __GNUC_MINOR__ < 96
+# ifdef __builtin_expect
+# undef __builtin_expect
+# endif
+# define __builtin_expect(x, expected_value) (x)
+# endif
+#else
+# error "Sorry, your compiler is too old/not supported."
+#endif
+
+/*
+ * Allow us to mark functions as 'deprecated' and have gcc emit a nice
+ * warning for each use, in hopes of speeding the functions removal.
+ * Usage is:
+ * int __deprecated foo(void)
+ */
+#ifndef __deprecated
+# define __deprecated /* unimplemented */
+#endif
+
+/* define likely() and unlikely() */
+#ifdef likely
+# undef likely
+#endif
+#ifdef unlikely
+# undef unlikely
+#endif
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
+#ifdef NOREGPARM
+# undef NOREGPARM
+#endif
+#define NOREGPARM __attribute__((regparm(0)))
+#ifdef REGPARM
+# undef REGPARM
+#endif
+#define REGPARM __attribute__((regparm(3)))
+
+#endif // __PWMANAGER_COMPILER_H