From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from blyat.fensystems.co.uk (blyat.fensystems.co.uk [54.246.183.96]) by mx.groups.io with SMTP id smtpd.web12.3978.1637623046194056797 for ; Mon, 22 Nov 2021 15:17:26 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: ipxe.org, ip: 54.246.183.96, mailfrom: mcb30@ipxe.org) Received: from pudding.home (unknown [IPv6:2a00:23c6:5486:8700:eaa7:4ea6:88e4:6f0e]) by blyat.fensystems.co.uk (Postfix) with ESMTPSA id 1319D44165; Mon, 22 Nov 2021 23:17:22 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdePkg: DebugLib: Compilation fix for clang-13. To: devel@edk2.groups.io, michael.d.kinney@intel.com, "krichanov@ispras.ru" Cc: "gaoliming@byosoft.com.cn" , "Liu, Zhiguang" , "vit9696@protonmail.com" References: <20211119090529.2865-1-krichanov@ispras.ru> From: "Michael Brown" Message-ID: <8d9101ac-fbda-eecf-950e-692fa375c3f9@ipxe.org> Date: Mon, 22 Nov 2021 23:17:21 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 22/11/2021 16:42, Michael D Kinney wrote: > You are also modifying the DebugLib in the paths where ASSERT() macros > are disabled. When they are disabled, we want all code/data associated > with ASSERT() to be removed by the optimizing compiler/linker. The source > code change appears to force a reference to a variable/expression. Does > this have any size impact to any of the toolchains when ASSERT() is > disabled? Can you provide the size comparison before and after this > change? I would very strongly recommend having the non-debug version of the macro use something like: #define ASSERT(Expression) do { \ if (FALSE) { \ (VOID) (Expression); \ } \ } while (FALSE) Without the "if (FALSE)", you will find that an expression that may have side-effects (e.g. by calling an external function) will result in executable code being generated. Michael