mirror of
				https://git.proxmox.com/git/mirror_edk2
				synced 2025-11-04 01:03:23 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									d6107c593b
								
							
						
					
					
						commit
						b17a3a133b
					
				@ -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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -348,7 +348,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Expression  Expression to be evaluated for TRUE.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_TRUE(Expression)                                                                 \
 | 
			
		||||
  if(!UnitTestAssertTrue ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
 | 
			
		||||
  if(!UnitTestAssertTrue ((Expression), __func__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                            \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -360,7 +360,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Expression  Expression to be evaluated for FALSE.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_FALSE(Expression)                                                                 \
 | 
			
		||||
  if(!UnitTestAssertFalse ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
 | 
			
		||||
  if(!UnitTestAssertFalse ((Expression), __func__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                             \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -373,7 +373,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  ValueB  Value to be compared for equality (64-bit comparison).
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_EQUAL(ValueA, ValueB)                                                                           \
 | 
			
		||||
  if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
 | 
			
		||||
  if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __func__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                                           \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -387,7 +387,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Length   Number of bytes to compare in BufferA and BufferB.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length)                                                                                                              \
 | 
			
		||||
  if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
 | 
			
		||||
  if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __func__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                                                                                            \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -400,7 +400,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  ValueB  Value to be compared for inequality (64-bit comparison).
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB)                                                                                       \
 | 
			
		||||
  if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
 | 
			
		||||
  if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __func__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                                                           \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -412,7 +412,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Status  EFI_STATUS value to check.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_NOT_EFI_ERROR(Status)                                                           \
 | 
			
		||||
  if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
 | 
			
		||||
  if(!UnitTestAssertNotEfiError ((Status), __func__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                           \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -425,7 +425,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Expected  EFI_STATUS values to compare for equality.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_STATUS_EQUAL(Status, Expected)                                                              \
 | 
			
		||||
  if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
 | 
			
		||||
  if(!UnitTestAssertStatusEqual ((Status), (Expected), __func__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                                       \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -437,7 +437,7 @@ SaveFrameworkState (
 | 
			
		||||
  @param[in]  Pointer  Pointer to be checked against NULL.
 | 
			
		||||
**/
 | 
			
		||||
#define UT_ASSERT_NOT_NULL(Pointer)                                                             \
 | 
			
		||||
  if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
 | 
			
		||||
  if(!UnitTestAssertNotNull ((Pointer), __func__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
 | 
			
		||||
    return UNIT_TEST_ERROR_TEST_FAILED;                                                         \
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -482,7 +482,7 @@ extern BASE_LIBRARY_JUMP_BUFFER  *gUnitTestExpectAssertFailureJumpBuffer;
 | 
			
		||||
      }                                                                \
 | 
			
		||||
      if (!UnitTestExpectAssertFailure (                               \
 | 
			
		||||
             UnitTestJumpStatus,                                       \
 | 
			
		||||
             __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__,                \
 | 
			
		||||
             __func__, DEBUG_LINE_NUMBER, __FILE__,                \
 | 
			
		||||
             #FunctionCall, Status)) {                                 \
 | 
			
		||||
        return UNIT_TEST_ERROR_TEST_FAILED;                            \
 | 
			
		||||
      }                                                                \
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user