From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.11964.1603378942262566967 for ; Thu, 22 Oct 2020 08:02:22 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D92C7D6E; Thu, 22 Oct 2020 08:02:20 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.102]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F9B73F66E; Thu, 22 Oct 2020 08:02:19 -0700 (PDT) Subject: Re: [PATCH v2 1/1] ArmPkg/ArmMmuLib: Explicitly cast function pointer argument To: michael.kubacki@outlook.com, devel@edk2.groups.io Cc: Leif Lindholm References: From: "Ard Biesheuvel" Message-ID: <07aa0b94-c5c7-7e6b-2f2d-ccd85fc499bb@arm.com> Date: Thu, 22 Oct 2020 17:02:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/20/20 12:12 AM, michael.kubacki@outlook.com wrote: > From: Michael Kubacki > > The function ArmReplaceLiveTranslationEntry () is passed as a VOID > pointer to WriteBackDataCacheRange (). This produces the following > warning on VS2019: > > warning C4152: nonstandard extension, function/data pointer > conversion in expression > > This change explicitly casts the argument to the formal parameter > type VOID*. > > This can be reproduced with the following build command: > build -b DEBUG -a AARCH64 -t VS2019 -p ArmPkg/ArmPkg.dsc > -m ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Signed-off-by: Michael Kubacki Thanks Michael Reviewed-by: Ard Biesheuvel But please, in the future, don't put spaces after () casts. I have pushed this patch and '[PATCH v1 1/1] ArmPkg/ArmMmuLib: Explicitly cast UINT32 data conversions' as #1042. Thanks, > --- > > Notes: > V2 changes: > > 1. Added a cast to UINTN prior to casting to VOID*. > > This also makes the change consistent with a very similar change > in commit 654dc3ed852a. > > ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c > index 80317923cfa4..5f259d216420 100644 > --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c > +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c > @@ -47,7 +47,7 @@ ArmMmuPeiLibConstructor ( > // The ArmReplaceLiveTranslationEntry () helper function may be invoked > // with the MMU off so we have to ensure that it gets cleaned to the PoC > // > - WriteBackDataCacheRange (ArmReplaceLiveTranslationEntry, > + WriteBackDataCacheRange ((VOID *) (UINTN) ArmReplaceLiveTranslationEntry, > ArmReplaceLiveTranslationEntrySize); > } > >