Received: from eggs.gnu.org ([140.186.70.92]:41828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwcDo-0001Kd-8t for qemu-devel@nongnu.org; Thu, 25 Aug 2011 11:52:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwcDi-0001R0-8g for qemu-devel@nongnu.org; Thu, 25 Aug 2011 11:51:55 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:39400) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QwcDh-0001QW-RO for qemu-devel@nongnu.org; Thu, 25 Aug 2011 11:51:54 -0400 From: =?utf-8?b?TGx1w61z?= Date: Thu, 25 Aug 2011 17:51:43 +0200 Message-ID: <20110825155143.19177.99563.stgit@ginnungagap.bsc.es> In-Reply-To: <20110825155128.19177.80104.stgit@ginnungagap.bsc.es> References: <20110825155128.19177.80104.stgit@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v6 02/14] provide support for default implementations using weak symbols List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, chouteau@adacore.com Cc: stefanha@gmail.com 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 --- 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 */