From nobody Tue Apr 30 07:23:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512898357756213.02321979166834; Sun, 10 Dec 2017 01:32:37 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0F7942217CE44; Sun, 10 Dec 2017 01:27:59 -0800 (PST) Received: from sonic310-35.consmr.mail.ne1.yahoo.com (sonic310-35.consmr.mail.ne1.yahoo.com [66.163.186.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D734A20356262 for ; Sun, 10 Dec 2017 01:27:57 -0800 (PST) Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Sun, 10 Dec 2017 09:32:31 +0000 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.163.186.216; helo=sonic310-35.consmr.mail.ne1.yahoo.com; envelope-from=zenith432@users.sourceforge.net; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1512898351; bh=lj5WoOzW6LqX7EPYZyMPY7tUFghFgH6uh7yAZhMjNHM=; h=Date:From:Reply-To:To:Cc:Subject:References:From:Subject; b=qZs8oQb49FKQlLZrmDzWZX0LE/t62dPrGVsLCsihHJPVckK1rIEGplKji+oTb2wQqBW9ZfRpttid/zTYKrFfF55yOo1MQcNWS4kVTMlFjEl9z0XWuEU3P862zw4JzXVJRDloCgrTBqJE4zjzuiyLHOzDkB3jV5h2/zfpVFPAW/9Bz8Y0HaDlyTYMYhJEpgYz4t7YyNhPo1t9Gyo7t5aE9WJ4NRYp0AGmCPqZ4WZ9vdoGuIDxYWATo10bedh5L3QC+94oVCVal11XsQfR2eWHwRgKAL7aKfaR3AcWh5P7k4DMaKxYGflmjdeSXODtWgm3YXzlTLpUEdXKpnoNEmbySQ== X-YMail-OSG: zf0L.3MVM1mjJfHrBOtFx4sNJaeIwyHPB0tbPskpiyb.eTE.M8KGtSjVbc61kVN lwRepXwM2MpaYiIScb9erqZdwdlFdjU5aOJm_.K_yp36z94YfglCRMutJ5TsdQcvagwxWlSUJg_D kW1TRb5nQNRznVJOi5joHiBkIG1g5863_udMZ4dSyGFm4OLxRZz.2UBr_FSzpdpX6kokPJl_Ms78 bWwwsLcx_ooxwZZamh.yxwxd2qnzd3wgJIgeyHRxNXx8NEhu8bmTvBlHb6WDG4BHU1MYMiQJwmvI KgT2grPAu3RswXD1dhvx3AAxdeT9j_mN1vtb0wcxKNczllEHyzXVKpqXOG2SJf_pe3LoK4mw4ZUF TgRZUpy5RzxArjObHH7Zbb4e2cKOevn_VD_MX7lmMEdbkvX3vC8ZGicy.9UujsSbYihNDO.tIAay e4WGfPc82Xy8CcFF5bQHlY4YvUK1KGIVn9JO3OKBVHutgxrMN8z5J7Mn6X7izYytnfGK5fRekUjJ Qd9k7rmPmBc_1D9gS85VD.GFSWPMD Date: Sun, 10 Dec 2017 09:32:26 +0000 (UTC) From: Zenith432 To: Message-ID: <1667068483.2112668.1512898346914@mail.yahoo.com> MIME-Version: 1.0 References: <1667068483.2112668.1512898346914.ref@mail.yahoo.com> X-Mailer: WebService/1.1.11051 YahooMailBasic Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0 Subject: [edk2] [PATCH] MdePkg: correct and clarify documentation of VA_LIST in Base.h X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Zenith432 Cc: michael.d.kinney@intel.com, liming.gao@intel.com Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is to resolve bug 457. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 Reviewed-by: Laszlo Ersek Reviewed-by: Liming Gao --- MdePkg/Include/Base.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 02140a5a..19f36872 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -560,13 +560,14 @@ struct _LIST_ENTRY { // VA_LIST - typedef for argument list. // VA_START (VA_LIST Marker, argument before the ...) - Init Marker for u= se. // VA_END (VA_LIST Marker) - Clear Marker -// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument = from -// the ... list. You must know the size and pass it in this macro. +// VA_ARG (VA_LIST Marker, var arg type) - Use Marker to get an argument = from +// the ... list. You must know the type and pass it in this macro. // VA_COPY (VA_LIST Dest, VA_LIST Start) - Initialize Dest as a copy of S= tart. // -// example: +// Example: // // UINTN +// EFIAPI // ExampleVarArg ( // IN UINTN NumberOfArgs, // ... @@ -582,7 +583,7 @@ struct _LIST_ENTRY { // VA_START (Marker, NumberOfArgs); // for (Index =3D 0, Result =3D 0; Index < NumberOfArgs; Index++) { // // -// // The ... list is a series of UINTN values, so average them up. +// // The ... list is a series of UINTN values, so sum them up. // // // Result +=3D VA_ARG (Marker, UINTN); // } @@ -591,6 +592,21 @@ struct _LIST_ENTRY { // return Result // } // +// Notes: +// +// This set of macros is intended to support variadic functions that +// use the EFIAPI calling convention. Variadic functions that use a +// native calling convention should use stdarg.h. +// In particular: +// -- VA_START may only be used in a variadic EFIAPI function. +// -- va_start may only be used in a variadic native function. +// -- VA_START, VA_END, VA_ARG and VA_COPY may only be used on a VA_LIST. +// -- va_start, va_end, va_arg and va_copy may only be used on a va_list. +// -- Both VA_LIST or va_list may be passed as arguments to functions +// of either EFIAPI or native calling conventions. +// -- VA_END, VA_ARG, VA_COPY, va_end, va_arg, and va_copy may be used +// in functions of either calling conventions. +// =20 /** Return the size of argument that has been aligned to sizeof (UINTN). --=20 2.14.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel