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 07/18] EmbeddedPkg: Update code to be more C11 compliant by using __func__
Date: Thu,  6 Apr 2023 16:23:08 -0600	[thread overview]
Message-ID: <20230406222319.2281263-8-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
EmbeddedPkg.

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>
---
 EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c       | 18 ++++++++--------
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c         | 10 ++++-----
 EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c           | 22 ++++++++++----------
 EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c |  2 +-
 EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c       |  2 +-
 EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c          | 20 +++++++++---------
 6 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
index 07b82892eb0f..2c2e73e72076 100644
--- a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
+++ b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
@@ -116,7 +116,7 @@ RemoveDtStdoutPath (
     DEBUG ((
       DEBUG_INFO,
       "%a: could not retrieve DT blob - %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return;
@@ -132,7 +132,7 @@ RemoveDtStdoutPath (
     DEBUG ((
       DEBUG_INFO,
       "%a: Failed to delete 'stdout-path' property: %a\n",
-      __FUNCTION__,
+      __func__,
       fdt_strerror (Error)
       ));
   }
@@ -190,7 +190,7 @@ RemoveSpcrTable (
       DEBUG ((
         DEBUG_WARN,
         "%a: failed to uninstall SPCR table - %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
     }
@@ -224,7 +224,7 @@ OnReadyToBoot (
     DEBUG ((
       DEBUG_ERROR,
       "%a: variable '%s' could not be read - bailing!\n",
-      __FUNCTION__,
+      __func__,
       CONSOLE_PREF_VARIABLE_NAME
       ));
     return;
@@ -234,7 +234,7 @@ OnReadyToBoot (
     DEBUG ((
       DEBUG_INFO,
       "%a: serial console preferred - doing nothing\n",
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -247,7 +247,7 @@ OnReadyToBoot (
     DEBUG ((
       DEBUG_INFO,
       "%a: no GOP instances found - doing nothing (%r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return;
@@ -296,7 +296,7 @@ ConsolePrefDxeEntryPoint (
     DEBUG ((
       DEBUG_INFO,
       "%a: no console preference found, defaulting to graphical\n",
-      __FUNCTION__
+      __func__
       ));
     ConsolePref.Console = CONSOLE_PREF_GRAPHICAL;
   }
@@ -308,7 +308,7 @@ ConsolePrefDxeEntryPoint (
     DEBUG ((
       DEBUG_WARN,
       "%a: invalid value for %s, defaulting to graphical\n",
-      __FUNCTION__,
+      __func__,
       CONSOLE_PREF_VARIABLE_NAME
       ));
     ConsolePref.Console = CONSOLE_PREF_GRAPHICAL;
@@ -332,7 +332,7 @@ ConsolePrefDxeEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: gRT->SetVariable () failed - %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       return Status;
diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
index 7f7e8c446c98..b94cd4da25d1 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
@@ -122,7 +122,7 @@ DtPlatformDxeEntryPoint (
     DEBUG ((
       DEBUG_WARN,
       "%a: no DTB blob could be loaded, defaulting to ACPI (Status == %r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     DtAcpiPref.Pref = DT_ACPI_SELECT_ACPI;
@@ -142,7 +142,7 @@ DtPlatformDxeEntryPoint (
       DEBUG ((
         DEBUG_WARN,
         "%a: no DT/ACPI preference found, defaulting to %a\n",
-        __FUNCTION__,
+        __func__,
         PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"
         ));
       DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT
@@ -157,7 +157,7 @@ DtPlatformDxeEntryPoint (
     DEBUG ((
       DEBUG_WARN,
       "%a: invalid value for %s, defaulting to %a\n",
-      __FUNCTION__,
+      __func__,
       DT_ACPI_VARIABLE_NAME,
       PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"
       ));
@@ -197,7 +197,7 @@ DtPlatformDxeEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n",
-        __FUNCTION__
+        __func__
         ));
       goto FreeDtb;
     }
@@ -211,7 +211,7 @@ DtPlatformDxeEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: failed to install FDT configuration table\n",
-        __FUNCTION__
+        __func__
         ));
       goto FreeDtb;
     }
diff --git a/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
index b182c77d19b1..7da505a313d7 100644
--- a/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
+++ b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
@@ -222,7 +222,7 @@ FindCompatibleNodeReg (
     DEBUG ((
       DEBUG_ERROR,
       "%a: '%a' compatible node has invalid 'reg' property (size == 0x%x)\n",
-      __FUNCTION__,
+      __func__,
       CompatibleString,
       *RegSize
       ));
@@ -263,7 +263,7 @@ FindNextMemoryNodeReg (
     }
 
     if (!IsNodeEnabled (Next)) {
-      DEBUG ((DEBUG_WARN, "%a: ignoring disabled memory node\n", __FUNCTION__));
+      DEBUG ((DEBUG_WARN, "%a: ignoring disabled memory node\n", __func__));
       continue;
     }
 
@@ -279,7 +279,7 @@ FindNextMemoryNodeReg (
         DEBUG ((
           DEBUG_WARN,
           "%a: ignoring memory node with no 'reg' property\n",
-          __FUNCTION__
+          __func__
           ));
         continue;
       }
@@ -288,7 +288,7 @@ FindNextMemoryNodeReg (
         DEBUG ((
           DEBUG_WARN,
           "%a: ignoring memory node with invalid 'reg' property (size == 0x%x)\n",
-          __FUNCTION__,
+          __func__,
           *RegSize
           ));
         continue;
@@ -391,7 +391,7 @@ OnPlatformHasDeviceTree (
   DEBUG ((
     DEBUG_INFO,
     "%a: exposing DTB @ 0x%p to OS\n",
-    __FUNCTION__,
+    __func__,
     DeviceTreeBase
     ));
   Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
@@ -424,7 +424,7 @@ InitializeFdtClientDxe (
     DEBUG ((
       DEBUG_ERROR,
       "%a: No DTB found @ 0x%p\n",
-      __FUNCTION__,
+      __func__,
       DeviceTreeBase
       ));
     return EFI_NOT_FOUND;
@@ -432,7 +432,7 @@ InitializeFdtClientDxe (
 
   mDeviceTreeBase = DeviceTreeBase;
 
-  DEBUG ((DEBUG_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
+  DEBUG ((DEBUG_INFO, "%a: DTB @ 0x%p\n", __func__, mDeviceTreeBase));
 
   //
   // Register a protocol notify for the EDKII Platform Has Device Tree
@@ -446,7 +446,7 @@ InitializeFdtClientDxe (
                   &PlatformHasDeviceTreeEvent
                   );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: CreateEvent(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: CreateEvent(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -459,7 +459,7 @@ InitializeFdtClientDxe (
     DEBUG ((
       DEBUG_ERROR,
       "%a: RegisterProtocolNotify(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto CloseEvent;
@@ -470,7 +470,7 @@ InitializeFdtClientDxe (
   //
   Status = gBS->SignalEvent (PlatformHasDeviceTreeEvent);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: SignalEvent(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: SignalEvent(): %r\n", __func__, Status));
     goto CloseEvent;
   }
 
@@ -484,7 +484,7 @@ InitializeFdtClientDxe (
     DEBUG ((
       DEBUG_ERROR,
       "%a: InstallProtocolInterface(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto CloseEvent;
diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
index 44a78c947ef4..e193352fbe41 100644
--- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
+++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
@@ -349,7 +349,7 @@ DmaMap (
     "%a: Operation type 'MapOperationBusMasterCommonBuffer' is only "
     "supported\non memory regions that were allocated using "
     "DmaAllocateBuffer ()\n",
-    __FUNCTION__
+    __func__
     ));
   Status = EFI_UNSUPPORTED;
 FreeMapInfo:
diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
index 7adb7324057e..17dde432c4eb 100644
--- a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
+++ b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
@@ -219,7 +219,7 @@ InitializeRealTimeClock (
     DEBUG ((
       DEBUG_WARN,
       "%a: using default timezone/daylight settings\n",
-      __FUNCTION__
+      __func__
       ));
 
     mTimeSettings.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
index 86eb55800e5a..57388d9f461c 100755
--- a/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
+++ b/EmbeddedPkg/Universal/MmcDxe/MmcIdentification.c
@@ -414,13 +414,13 @@ InitializeSdMmcDevice (
 
   Status = MmcHost->SendCommand (MmcHost, MMC_CMD55, CmdArg);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __func__, Status));
     return Status;
   }
 
   Status = MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __func__, Status));
     return Status;
   }
 
@@ -473,18 +473,18 @@ InitializeSdMmcDevice (
     CmdArg = CreateSwitchCmdArgument (0, 0, 0);
     Status = MmcHost->SendCommand (MmcHost, MMC_CMD6, CmdArg);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __func__, Status));
       return Status;
     } else {
       Status = MmcHost->ReadBlockData (MmcHost, 0, SWITCH_CMD_DATA_LENGTH, Buffer);
       if (EFI_ERROR (Status)) {
-        DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __FUNCTION__, Status));
+        DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __func__, Status));
         return Status;
       }
     }
 
     if (!(Buffer[3] & SD_HIGH_SPEED_SUPPORTED)) {
-      DEBUG ((DEBUG_INFO, "%a : High Speed not supported by Card\n", __FUNCTION__));
+      DEBUG ((DEBUG_INFO, "%a : High Speed not supported by Card\n", __func__));
     } else {
       Speed = SD_HIGH_SPEED;
 
@@ -492,12 +492,12 @@ InitializeSdMmcDevice (
       CmdArg = CreateSwitchCmdArgument (1, 0, 1);
       Status = MmcHost->SendCommand (MmcHost, MMC_CMD6, CmdArg);
       if (EFI_ERROR (Status)) {
-        DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __FUNCTION__, Status));
+        DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __func__, Status));
         return Status;
       } else {
         Status = MmcHost->ReadBlockData (MmcHost, 0, SWITCH_CMD_DATA_LENGTH, Buffer);
         if (EFI_ERROR (Status)) {
-          DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __FUNCTION__, Status));
+          DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): ReadBlockData Error and Status = %r\n", __func__, Status));
           return Status;
         }
 
@@ -513,14 +513,14 @@ InitializeSdMmcDevice (
     CmdArg = MmcHostInstance->CardInfo.RCA << 16;
     Status = MmcHost->SendCommand (MmcHost, MMC_CMD55, CmdArg);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD55): Error and Status = %r\n", __func__, Status));
       return Status;
     }
 
     /* Width: 4 */
     Status = MmcHost->SendCommand (MmcHost, MMC_CMD6, 2);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a (MMC_CMD6): Error and Status = %r\n", __func__, Status));
       return Status;
     }
   }
@@ -528,7 +528,7 @@ InitializeSdMmcDevice (
   if (MMC_HOST_HAS_SETIOS (MmcHost)) {
     Status = MmcHost->SetIos (MmcHost, Speed, BUSWIDTH_4, EMMCBACKWARD);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a (SetIos): Error and Status = %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a (SetIos): Error and Status = %r\n", __func__, Status));
       return Status;
     }
   }
-- 
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 ` Rebecca Cran [this message]
2023-04-07  8:25   ` [PATCH 07/18] EmbeddedPkg: " 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 ` [PATCH 12/18] StandaloneMmPkg: " Rebecca Cran
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-8-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