summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library
diff options
context:
space:
mode:
authorRebecca Cran <rebecca@quicinc.com>2023-02-09 07:29:22 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-03-17 17:55:48 +0000
commitb17a3a133b18fb41493fba7d86e9b5804ea6a8cf (patch)
treec4082c17af98f880a14f8128047b324ef9f81859 /MdePkg/Library
parentd6107c593bd0a6e9659b5290d245e22614232b4a (diff)
downloadedk2-b17a3a133b18fb41493fba7d86e9b5804ea6a8cf.tar.gz
edk2-b17a3a133b18fb41493fba7d86e9b5804ea6a8cf.tar.bz2
edk2-b17a3a133b18fb41493fba7d86e9b5804ea6a8cf.zip
MdePkg: 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 MdePkg. 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@quicinc.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c6
-rw-r--r--MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c10
-rw-r--r--MdePkg/Library/BaseLib/SafeString.c2
-rw-r--r--MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c4
-rw-r--r--MdePkg/Library/DxeRngLib/DxeRngLib.c14
5 files changed, 18 insertions, 18 deletions
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c
index 4c8773278c..617b0f4218 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c
@@ -100,7 +100,7 @@ WriteBackInvalidateDataCache (
VOID
)
{
- DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __func__));
}
/**
@@ -136,7 +136,7 @@ WriteBackInvalidateDataCacheRange (
IN UINTN Length
)
{
- DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __func__));
return Address;
}
@@ -191,7 +191,7 @@ WriteBackDataCacheRange (
IN UINTN Length
)
{
- DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Not currently implemented on LoongArch.\n", __func__));
return Address;
}
diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
index 9a6d57d841..d08fb9f193 100644
--- a/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
+++ b/MdePkg/Library/BaseCacheMaintenanceLib/RiscVCache.c
@@ -101,7 +101,7 @@ WriteBackInvalidateDataCache (
VOID
)
{
- DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __func__));
}
/**
@@ -137,7 +137,7 @@ WriteBackInvalidateDataCacheRange (
IN UINTN Length
)
{
- DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __func__));
return Address;
}
@@ -157,7 +157,7 @@ WriteBackDataCache (
VOID
)
{
- DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __func__));
}
/**
@@ -192,7 +192,7 @@ WriteBackDataCacheRange (
IN UINTN Length
)
{
- DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __func__));
return Address;
}
@@ -250,6 +250,6 @@ InvalidateDataCacheRange (
IN UINTN Length
)
{
- DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a:RISC-V unsupported function.\n", __func__));
return Address;
}
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index b75b333817..954d3f8c89 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -17,7 +17,7 @@
if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \
- __FILE__, DEBUG_LINE_NUMBER, __FUNCTION__, DEBUG_EXPRESSION_STRING (Expression), Status)); \
+ __FILE__, DEBUG_LINE_NUMBER, __func__, DEBUG_EXPRESSION_STRING (Expression), Status)); \
return Status; \
} \
} while (FALSE)
diff --git a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
index f47301de89..a23113f9c9 100644
--- a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
+++ b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
@@ -1416,7 +1416,7 @@ RedBlackTreeValidate (
CONST RED_BLACK_TREE_NODE *Last;
CONST RED_BLACK_TREE_NODE *Node;
- DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p\n", __FUNCTION__, Tree));
+ DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p\n", __func__, Tree));
//
// property #5
@@ -1459,7 +1459,7 @@ RedBlackTreeValidate (
DEBUG ((
DEBUG_VERBOSE,
"%a: Tree=%p BlackHeight=%Ld Count=%Ld\n",
- __FUNCTION__,
+ __func__,
Tree,
(INT64)BlackHeight,
(INT64)ForwardCount
diff --git a/MdePkg/Library/DxeRngLib/DxeRngLib.c b/MdePkg/Library/DxeRngLib/DxeRngLib.c
index 82129aa445..46aea51592 100644
--- a/MdePkg/Library/DxeRngLib/DxeRngLib.c
+++ b/MdePkg/Library/DxeRngLib/DxeRngLib.c
@@ -37,43 +37,43 @@ GenerateRandomNumberViaNist800Algorithm (
RngProtocol = NULL;
if (Buffer == NULL) {
- DEBUG ((DEBUG_ERROR, "%a: Buffer == NULL.\n", __FUNCTION__));
+ DEBUG ((DEBUG_ERROR, "%a: Buffer == NULL.\n", __func__));
return EFI_INVALID_PARAMETER;
}
Status = gBS->LocateProtocol (&gEfiRngProtocolGuid, NULL, (VOID **)&RngProtocol);
if (EFI_ERROR (Status) || (RngProtocol == NULL)) {
- DEBUG ((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __func__, Status));
return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Ctr256Guid, BufferSize, Buffer);
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __func__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hmac256Guid, BufferSize, Buffer);
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __func__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hash256Guid, BufferSize, Buffer);
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __func__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
// If all the other methods have failed, use the default method from the RngProtocol
Status = RngProtocol->GetRNG (RngProtocol, NULL, BufferSize, Buffer);
- DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __func__, Status));
if (!EFI_ERROR (Status)) {
return Status;
}
// If we get to this point, we have failed
- DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __FUNCTION__, Status));
+ DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __func__, Status));
return Status;
}// GenerateRandomNumberViaNist800Algorithm()