[edk2-devel] [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__

Rebecca Cran posted 18 patches 2 years, 10 months ago
[edk2-devel] [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__
Posted by Rebecca Cran 2 years, 10 months ago
__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
UefiPayloadPkg.

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>
---
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 ++--
 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 790e6109c03e..57274754141d 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -135,7 +135,7 @@ InitRootBridge (
                  &mRootBridgeDevicePathTemplate
                  );
   if (DevicePath == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -145,7 +145,7 @@ InitRootBridge (
   DEBUG ((
     DEBUG_INFO,
     "%a: populated root bus %d, with room for %d subordinate bus(es)\n",
-    __FUNCTION__,
+    __func__,
     RootBusNumber,
     MaxSubBusNumber - RootBusNumber
     ));
diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index c66e56aee15a..61a9f01ec9e7 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -355,7 +355,7 @@ HandOffToDxeCore (
     DEBUG ((
       DEBUG_INFO,
       "%a() Stack Base: 0x%lx, Stack Size: 0x%x\n",
-      __FUNCTION__,
+      __func__,
       BaseOfStack,
       STACK_SIZE
       ));
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102647): https://edk2.groups.io/g/devel/message/102647
Mute This Topic: https://groups.io/mt/98115256/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__
Posted by Lu, James 2 years, 10 months ago
Reviewed-by: James Lu <james.lu@intel.com>


Thanks,
James

-----Original Message-----
From: Rebecca Cran <rebecca@bsdio.com> 
Sent: Friday, April 7, 2023 6:23 AM
To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Kinney, Michael D <michael.d.kinney@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>; Xu, Wei6 <wei6.xu@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Andrew Fish <afish@apple.com>; Wu, Hao A <hao.a.wu@intel.com>; Maciej Rabeda <maciej.rabeda@linux.intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1 <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>; Desimone, Nathaniel L <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>; Xu, Min M <min.m.xu@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Peter Grehan <grehan@freebsd.org>; Aktas, Erdem <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>; Warkentin, Andrei <andrei.warkentin@intel.com>
Subject: [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__

__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 UefiPayloadPkg.

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>
---
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 ++--
 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 790e6109c03e..57274754141d 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -135,7 +135,7 @@ InitRootBridge (
                  &mRootBridgeDevicePathTemplate
                  );
   if (DevicePath == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -145,7 +145,7 @@ InitRootBridge (
   DEBUG ((
     DEBUG_INFO,
     "%a: populated root bus %d, with room for %d subordinate bus(es)\n",
-    __FUNCTION__,
+    __func__,
     RootBusNumber,
     MaxSubBusNumber - RootBusNumber
     ));
diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index c66e56aee15a..61a9f01ec9e7 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -355,7 +355,7 @@ HandOffToDxeCore (
     DEBUG ((
       DEBUG_INFO,
       "%a() Stack Base: 0x%lx, Stack Size: 0x%x\n",
-      __FUNCTION__,
+      __func__,
       BaseOfStack,
       STACK_SIZE
       ));
--
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102674): https://edk2.groups.io/g/devel/message/102674
Mute This Topic: https://groups.io/mt/98115256/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__
Posted by Guo, Gua 2 years, 10 months ago
Reviewed-by: Gua Guo <gua.guo@intel.com>

-----Original Message-----
From: Rebecca Cran <rebecca@bsdio.com> 
Sent: Friday, April 7, 2023 6:23 AM
To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Kinney, Michael D <michael.d.kinney@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>; Xu, Wei6 <wei6.xu@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Andrew Fish <afish@apple.com>; Wu, Hao A <hao.a.wu@intel.com>; Maciej Rabeda <maciej.rabeda@linux.intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1 <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>; Desimone, Nathaniel L <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>; Xu, Min M <min.m.xu@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Peter Grehan <grehan@freebsd.org>; Aktas, Erdem <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>; Warkentin, Andrei <andrei.warkentin@intel.com>
Subject: [PATCH 17/18] UefiPayloadPkg: Update code to be more C11 compliant by using __func__

__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 UefiPayloadPkg.

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>
---
 UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 ++--
 UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 790e6109c03e..57274754141d 100644
--- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -135,7 +135,7 @@ InitRootBridge (
                  &mRootBridgeDevicePathTemplate
                  );
   if (DevicePath == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -145,7 +145,7 @@ InitRootBridge (
   DEBUG ((
     DEBUG_INFO,
     "%a: populated root bus %d, with room for %d subordinate bus(es)\n",
-    __FUNCTION__,
+    __func__,
     RootBusNumber,
     MaxSubBusNumber - RootBusNumber
     ));
diff --git a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
index c66e56aee15a..61a9f01ec9e7 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/Ia32/DxeLoadFunc.c
@@ -355,7 +355,7 @@ HandOffToDxeCore (
     DEBUG ((
       DEBUG_INFO,
       "%a() Stack Base: 0x%lx, Stack Size: 0x%x\n",
-      __FUNCTION__,
+      __func__,
       BaseOfStack,
       STACK_SIZE
       ));
--
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102664): https://edk2.groups.io/g/devel/message/102664
Mute This Topic: https://groups.io/mt/98115256/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-