From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=74.6.128.48; helo=sonic304-25.consmr.mail.bf2.yahoo.com; envelope-from=zenith432@users.sourceforge.net; receiver=edk2-devel@lists.01.org Received: from sonic304-25.consmr.mail.bf2.yahoo.com (sonic304-25.consmr.mail.bf2.yahoo.com [74.6.128.48]) (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 9D46320356262 for ; Sun, 10 Dec 2017 07:38:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1512920613; bh=jiV1coVi00VImZJI7U5O5qnz6yn5wpW3do18BOGx91g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=VoSI+CnLJ3EiHFfxwhijcFBg70HKkvTByZx19f1DZg5XxjEi/uu8/wjs3JpUtS+D4IIHb55/fc33uEwX30kn8i2Uda03UbSiRScMhyfc9Fi5UYwULeCQYc+fSZhZmVx/nB2pbg+hsoPgJG3Wu4KzBeW0PrvAPmPX121kIT5XIIFW/iXg9hNDJyMyAxdM/gPcHreIDp+4Smyx1mq1tMiQoQHFQkbdtWF2oIMP17j0kgUwiX8NXPi9h/NDUYxkpTRgWtJHW2+AhiWrcJYWh7Fa2c1DW1gsMvDa8+yLNM3KdyKr2vItV3W3cAalPMNSM/ljUdL7amleDsF8L25/QqaE9w== X-YMail-OSG: d7.iYjMVM1nodLcHsnzI.9Mq6e.jUHrp7bdJ7WA89inmj8mm7MdIuT1L3KpO7L6 W8ujaRPRKYOsbuoR2PY53GdnAC7jBIBaPl8k0UO9wItz2RUv9sIkj4J5WTGRWmrU6KiW2iTTdUN1 MwD1KN43HRZbk7ERCM9shCFraH9QXXUrqqOU.doMnThoGVyRyaUgDuOcMLdSZ_KXsJ2qwa7.uek5 tYmUijbbuW4tWN_jyCa35vk_5tPz_iyThsdLmw2GhRZRPlyI9rWFf1iYyGaV0LHWsTq4BMYj2dDP Fz60wusmHMcpNXaE5d8YUYCRYgweqsFi.BH4v84lKf0Gi4RDFKgeqmeatw4pJzXlbzr8W7erzBek Ja2vQ4op5Ci2d2MpERocLiccipXPCN1_9wlabGfhFlIKaSry2_e_1Lobs602NTRnnO6G3vwiZ6s2 fEc98TPvdHhSNJKFXN9C1x98niRo71pPjotAB1LZ5.hggzXHgspx96dSYJsJBA.9F.VhrW9jk2Y8 5UuAw_Gb3id4Scrje5V3bTYV7 Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Sun, 10 Dec 2017 15:43:33 +0000 Received: from smtpgate104.mail.bf1.yahoo.com (EHLO robicon.homeip.net) ([72.30.28.112]) by smtp416.mail.bf1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 1444586991; Sun, 10 Dec 2017 15:43:30 +0000 (UTC) To: "Gao, Liming" , "edk2-devel@lists.01.org" Cc: "Kinney, Michael D" References: <1667068483.2112668.1512898346914.ref@mail.yahoo.com> <1667068483.2112668.1512898346914@mail.yahoo.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E18E2A8@SHSMSX104.ccr.corp.intel.com> From: Zenith432 Message-ID: <2dfbe819-78d5-e328-dd10-9c614e901d05@users.sourceforge.net> Date: Sun, 10 Dec 2017 17:43:28 +0200 User-Agent: Thunderbird/52.5 MIME-Version: 1.0 In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E18E2A8@SHSMSX104.ccr.corp.intel.com> Subject: Re: [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: , X-List-Received-Date: Sun, 10 Dec 2017 15:38:57 -0000 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/12/2017 03:53 PM, Gao, Liming wrote: > Could you add bug 457 link in the commit message? --- Subject: [PATCH] MdePkg: correct and clarify documentation of VA_LIST in Base.h This is to resolve bug 457. https://bugzilla.tianocore.org/show_bug.cgi?id=457 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 --- 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 use. // 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 Start. // -// example: +// Example: // // UINTN +// EFIAPI // ExampleVarArg ( // IN UINTN NumberOfArgs, // ... @@ -582,7 +583,7 @@ struct _LIST_ENTRY { // VA_START (Marker, NumberOfArgs); // for (Index = 0, Result = 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 += 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. +// /** Return the size of argument that has been aligned to sizeof (UINTN). -- 2.14.3