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>
This commit is contained in:
Rebecca Cran
2023-02-09 07:29:22 -07:00
committed by mergify[bot]
parent d6107c593b
commit b17a3a133b
7 changed files with 33 additions and 33 deletions

View File

@@ -526,7 +526,7 @@ LogPerformanceMeasurement (
#define PERF_EVENT_SIGNAL_BEGIN(EventGuid) \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_START_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __func__ , 0, PERF_EVENTSIGNAL_START_ID); \
} \
} while (FALSE)
@@ -542,7 +542,7 @@ LogPerformanceMeasurement (
#define PERF_EVENT_SIGNAL_END(EventGuid) \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_END_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __func__ , 0, PERF_EVENTSIGNAL_END_ID); \
} \
} while (FALSE)
@@ -558,7 +558,7 @@ LogPerformanceMeasurement (
#define PERF_CALLBACK_BEGIN(TriggerGuid) \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_START_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __func__ , 0, PERF_CALLBACK_START_ID); \
} \
} while (FALSE)
@@ -574,7 +574,7 @@ LogPerformanceMeasurement (
#define PERF_CALLBACK_END(TriggerGuid) \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_END_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __func__ , 0, PERF_CALLBACK_END_ID); \
} \
} while (FALSE)
@@ -589,7 +589,7 @@ LogPerformanceMeasurement (
#define PERF_FUNCTION_BEGIN() \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_START_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __func__ , 0, PERF_FUNCTION_START_ID); \
} \
} while (FALSE)
@@ -604,7 +604,7 @@ LogPerformanceMeasurement (
#define PERF_FUNCTION_END() \
do { \
if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_END_ID); \
LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __func__ , 0, PERF_FUNCTION_END_ID); \
} \
} while (FALSE)