From patchwork Thu Aug 25 15:51:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?Q?Llu=C3=ADs?= X-Patchwork-Id: 111604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F0ACB6EE8 for ; Fri, 26 Aug 2011 01:52:12 +1000 (EST) Received: from localhost ([::1]:39465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwcDx-0001ls-Kb for incoming@patchwork.ozlabs.org; Thu, 25 Aug 2011 11:52:09 -0400 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 Received: (qmail invoked by alias); 25 Aug 2011 15:51:52 -0000 Received: from unknown (EHLO localhost) [84.88.53.92] by mail.gmx.net (mp056) with SMTP; 25 Aug 2011 17:51:52 +0200 X-Authenticated: #12333383 X-Provags-ID: V01U2FsdGVkX19MheoFV65MAbHJB0qbFs1BBB0QjsvpObQrciFYKn RCyPUyurWaLybO To: qemu-devel@nongnu.org, chouteau@adacore.com 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> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.22 Cc: stefanha@gmail.com Subject: [Qemu-devel] [PATCH v6 02/14] provide support for default implementations using weak symbols X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 */