public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: devel@edk2.groups.io, Liming Gao <gaoliming@byosoft.com.cn>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Guomin Jiang <guomin.jiang@intel.com>,
	Wei6 Xu <wei6.xu@intel.com>, Guo Dong <guo.dong@intel.com>,
	Ray Ni <ray.ni@intel.com>, Sean Rhodes <sean@starlabs.systems>,
	James Lu <james.lu@intel.com>, Gua Guo <gua.guo@intel.com>,
	Andrew Fish <afish@apple.com>, Hao A Wu <hao.a.wu@intel.com>,
	Maciej Rabeda <maciej.rabeda@linux.intel.com>,
	Siyuan Fu <siyuan.fu@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Xiaoyu Lu <xiaoyu1.lu@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>
Cc: Rebecca Cran <rebecca@bsdio.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Abner Chang <abner.chang@amd.com>,
	Nickle Wang <nicklew@nvidia.com>,
	Igor Kulchytskyy <igork@ami.com>,
	Daniel Schaefer <git@danielschaefer.me>,
	Min Xu <min.m.xu@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Peter Grehan <grehan@freebsd.org>,
	Erdem Aktas <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Michael Roth <michael.roth@amd.com>,
	Sunil V L <sunilvl@ventanamicro.com>,
	Andrei Warkentin <andrei.warkentin@intel.com>
Subject: [PATCH 12/18] StandaloneMmPkg: Update code to be more C11 compliant by using __func__
Date: Thu,  6 Apr 2023 16:23:13 -0600	[thread overview]
Message-ID: <20230406222319.2281263-13-rebecca@bsdio.com> (raw)
In-Reply-To: <20230406222319.2281263-1-rebecca@bsdio.com>

__FUNCTION__ is a pre-standard extension that gcc and Visual C++ among
others support, while __func__ was standardized in C99.

Since it's more standard, replace __FUNCTION__ with __func__ throughout
StandaloneMmPkg.

Visual Studio versions before VS 2015 don't support __func__ and so
will fail to compile. A workaround is to define __func__ as
__FUNCTION__ :

  #define __func__ __FUNCTION__

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c                             | 22 ++++++++++----------
 StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c                          |  2 +-
 StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c | 16 +++++++-------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
index 8f2833a13512..5c6bd0e1d7d2 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c
@@ -80,7 +80,7 @@ UpdateMmFoundationPeCoffPermissions (
       DEBUG ((
         DEBUG_ERROR,
         "%a: ImageContext->ImageRead () failed (Status = %r)\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       return Status;
@@ -89,7 +89,7 @@ UpdateMmFoundationPeCoffPermissions (
     DEBUG ((
       DEBUG_INFO,
       "%a: Section %d of image at 0x%lx has 0x%x permissions\n",
-      __FUNCTION__,
+      __func__,
       Index,
       ImageContext->ImageAddress,
       SectionHeader.Characteristics
@@ -97,7 +97,7 @@ UpdateMmFoundationPeCoffPermissions (
     DEBUG ((
       DEBUG_INFO,
       "%a: Section %d of image at 0x%lx has %a name\n",
-      __FUNCTION__,
+      __func__,
       Index,
       ImageContext->ImageAddress,
       SectionHeader.Name
@@ -105,7 +105,7 @@ UpdateMmFoundationPeCoffPermissions (
     DEBUG ((
       DEBUG_INFO,
       "%a: Section %d of image at 0x%lx has 0x%x address\n",
-      __FUNCTION__,
+      __func__,
       Index,
       ImageContext->ImageAddress,
       ImageContext->ImageAddress + SectionHeader.VirtualAddress
@@ -113,7 +113,7 @@ UpdateMmFoundationPeCoffPermissions (
     DEBUG ((
       DEBUG_INFO,
       "%a: Section %d of image at 0x%lx has 0x%x data\n",
-      __FUNCTION__,
+      __func__,
       Index,
       ImageContext->ImageAddress,
       SectionHeader.PointerToRawData
@@ -133,7 +133,7 @@ UpdateMmFoundationPeCoffPermissions (
         DEBUG ((
           DEBUG_INFO,
           "%a: Mapping section %d of image at 0x%lx with RW-XN permissions\n",
-          __FUNCTION__,
+          __func__,
           Index,
           ImageContext->ImageAddress
           ));
@@ -141,7 +141,7 @@ UpdateMmFoundationPeCoffPermissions (
         DEBUG ((
           DEBUG_INFO,
           "%a: Mapping section %d of image at 0x%lx with RO-XN permissions\n",
-          __FUNCTION__,
+          __func__,
           Index,
           ImageContext->ImageAddress
           ));
@@ -150,7 +150,7 @@ UpdateMmFoundationPeCoffPermissions (
       DEBUG ((
         DEBUG_INFO,
         "%a: Ignoring section %d of image at 0x%lx with 0x%x permissions\n",
-        __FUNCTION__,
+        __func__,
         Index,
         ImageContext->ImageAddress,
         SectionHeader.Characteristics
@@ -251,7 +251,7 @@ GetPeCoffSectionInformation (
     DEBUG ((
       DEBUG_ERROR,
       "%a: PeCoffLoaderGetImageInfo () failed (Status == %r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return Status;
@@ -266,7 +266,7 @@ GetPeCoffSectionInformation (
       DEBUG ((
         DEBUG_WARN,
         "%a: non-TE Image at 0x%lx has SectionAlignment < 4 KB (%lu)\n",
-        __FUNCTION__,
+        __func__,
         ImageContext->ImageAddress,
         ImageContext->SectionAlignment
         ));
@@ -296,7 +296,7 @@ GetPeCoffSectionInformation (
     DEBUG ((
       DEBUG_ERROR,
       "%a: TmpContext->ImageRead () failed (Status = %r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return Status;
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
index c309d1bc6a56..0b4b1174de18 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
@@ -95,7 +95,7 @@ MmMemLibInternalPopulateMmramRanges (
   EFI_MMRAM_DESCRIPTOR            *MmramDescriptors;
 
   HobStart = GetHobList ();
-  DEBUG ((DEBUG_INFO, "%a - 0x%x\n", __FUNCTION__, HobStart));
+  DEBUG ((DEBUG_INFO, "%a - 0x%x\n", __func__, HobStart));
 
   //
   // Extract MM Core Private context from the Hob. If absent search for
diff --git a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
index 426fd8dd74ac..492252843e12 100644
--- a/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmPeCoffExtraActionLib/AArch64/StandaloneMmPeCoffExtraActionLib.c
@@ -55,7 +55,7 @@ UpdatePeCoffPermissions (
       DEBUG ((
         DEBUG_ERROR,
         "%a: PeCoffLoaderGetImageInfo () failed (Status = %r)\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       return Status;
@@ -68,7 +68,7 @@ UpdatePeCoffPermissions (
     DEBUG ((
       DEBUG_INFO,
       "%a: ignoring XIP TE image at 0x%lx\n",
-      __FUNCTION__,
+      __func__,
       ImageContext->ImageAddress
       ));
     return RETURN_SUCCESS;
@@ -84,7 +84,7 @@ UpdatePeCoffPermissions (
       DEBUG ((
         DEBUG_WARN,
         "%a: non-TE Image at 0x%lx has SectionAlignment < 4 KB (%lu)\n",
-        __FUNCTION__,
+        __func__,
         ImageContext->ImageAddress,
         TmpContext.SectionAlignment
         ));
@@ -114,7 +114,7 @@ UpdatePeCoffPermissions (
     DEBUG ((
       DEBUG_ERROR,
       "%a: TmpContext.ImageRead () failed (Status = %r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return Status;
@@ -156,7 +156,7 @@ UpdatePeCoffPermissions (
       DEBUG ((
         DEBUG_ERROR,
         "%a: TmpContext.ImageRead () failed (Status = %r)\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       return Status;
@@ -169,7 +169,7 @@ UpdatePeCoffPermissions (
         DEBUG ((
           DEBUG_INFO,
           "%a: Mapping section %d of image at 0x%lx with RO-XN permissions and size 0x%x\n",
-          __FUNCTION__,
+          __func__,
           Index,
           Base,
           SectionHeader.Misc.VirtualSize
@@ -179,7 +179,7 @@ UpdatePeCoffPermissions (
         DEBUG ((
           DEBUG_WARN,
           "%a: Mapping section %d of image at 0x%lx with RW-XN permissions and size 0x%x\n",
-          __FUNCTION__,
+          __func__,
           Index,
           Base,
           SectionHeader.Misc.VirtualSize
@@ -189,7 +189,7 @@ UpdatePeCoffPermissions (
       DEBUG ((
         DEBUG_INFO,
         "%a: Mapping section %d of image at 0x%lx with RO-X permissions and size 0x%x\n",
-        __FUNCTION__,
+        __func__,
         Index,
         Base,
         SectionHeader.Misc.VirtualSize
-- 
2.34.1


  parent reply	other threads:[~2023-04-06 22:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 22:23 [PATCH 00/18] Replace pre-standard macro __FUNCTION__ with C99 __func__ throughout edk2 Rebecca Cran
2023-04-06 22:23 ` [PATCH 01/18] ArmPkg: Update code to be more C11 compliant by using __func__ Rebecca Cran
2023-04-07 20:18   ` [edk2-devel] " Michael D Kinney
2023-04-06 22:23 ` [PATCH 02/18] ArmVirtPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 03/18] UefiCpuPkg: " Rebecca Cran
2023-04-07  3:09   ` Ni, Ray
2023-04-07 11:24   ` Sunil V L
2023-04-06 22:23 ` [PATCH 04/18] OvmfPkg: " Rebecca Cran
2023-04-07 11:19   ` Sunil V L
2023-04-06 22:23 ` [PATCH 05/18] MdeModulePkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 06/18] SecurityPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 07/18] EmbeddedPkg: " Rebecca Cran
2023-04-07  8:25   ` Chang, Abner
2023-04-06 22:23 ` [PATCH 08/18] RedfishPkg: " Rebecca Cran
2023-04-07  5:39   ` Nickle Wang
2023-04-06 22:23 ` [PATCH 09/18] ArmPlatformPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 10/18] UnitTestFrameworkPkg: Update " Rebecca Cran
2023-04-06 22:23 ` [PATCH 11/18] PrmPkg: Update code " Rebecca Cran
2023-04-06 22:23 ` Rebecca Cran [this message]
2023-04-06 22:23 ` [PATCH 13/18] CryptoPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 14/18] NetworkPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 15/18] SourceLevelDebugPkg: " Rebecca Cran
2023-04-07  3:08   ` Ni, Ray
2023-04-06 22:23 ` [PATCH 16/18] EmulatorPkg: " Rebecca Cran
2023-04-07  3:08   ` Ni, Ray
2023-04-07  8:23   ` Chang, Abner
2023-04-06 22:23 ` [PATCH 17/18] UefiPayloadPkg: " Rebecca Cran
2023-04-07  5:57   ` Guo, Gua
2023-04-07  7:55   ` Lu, James
2023-04-06 22:23 ` [PATCH 18/18] FmpDevicePkg: " Rebecca Cran
2023-04-10  1:05   ` Xu, Wei6
2023-04-07 10:09 ` [edk2-devel] [PATCH 00/18] Replace pre-standard macro __FUNCTION__ with C99 __func__ throughout edk2 Ard Biesheuvel
2023-04-10 14:21 ` Rebecca Cran
2023-04-11  9:15 ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406222319.2281263-13-rebecca@bsdio.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox