[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 02/14] provide support for default implementation
From: |
Lluís |
Subject: |
[Qemu-devel] [PATCH v6 02/14] provide support for default implementations using weak symbols |
Date: |
Thu, 25 Aug 2011 17:51:43 +0200 |
User-agent: |
StGit/0.15 |
Routines using the QEMU_WEAK attribute can have a default implementation that
can be later overriden just by re-implementing it.
Signed-off-by: Lluís Vilanova <address@hidden>
---
compiler.h | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/compiler.h b/compiler.h
index 9af5dc6..bc06760 100644
--- a/compiler.h
+++ b/compiler.h
@@ -12,7 +12,7 @@
#define QEMU_WARN_UNUSED_RESULT
#endif
-#define QEMU_BUILD_BUG_ON(x) \
+#define QEMU_BUILD_BUG_ON(x) \
typedef char qemu_build_bug_on__##__LINE__[(x)?-1:1];
#if defined __GNUC__
@@ -31,4 +31,15 @@
#define GCC_FMT_ATTR(n, m)
#endif
+/* Routine attribute to provide default (overridable) implementations.
+ *
+ * The code providing the default implementation must define QEMU_WEAK_DEFAULT
+ * before including this file.
+ */
+#if !defined(QEMU_WEAK_DEFAULT)
+#define QEMU_WEAK
+#else
+#define QEMU_WEAK __attribute__((weak))
+#endif
+
#endif /* COMPILER_H */
- [Qemu-devel] [PATCH v6 00/14] trace-state: make the behaviour of "disable" consistent across all backends, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 01/14] [simple] Include qemu-timer-common.o in trace-obj-y, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 02/14] provide support for default implementations using weak symbols,
Lluís <=
- [Qemu-devel] [PATCH v6 03/14] trace: [configure] rename CONFIG_*_TRACE into CONFIG_TRACE_*, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 04/14] trace: [make] replace 'ifeq' with values in CONFIG_TRACE_*, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 05/14] trace: move backend-specific code into the trace/ directory, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 06/14] trace: avoid conditional code compilation during option parsing, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 07/14] trace: generalize the "property" concept in the trace-events file, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 08/14] trace-state: separate trace event control and query routines from the simple backend, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 10/14] trace-state: add "-trace events" argument to control initial state, Lluís, 2011/08/25
- [Qemu-devel] [PATCH v6 09/14] trace-state: always compile support for controlling and querying trace event states, Lluís, 2011/08/25