UnitTestFrameworkPkg: Update 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
UnitTestFrameworkPkg.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Rebecca Cran
2023-04-06 13:51:51 -06:00
committed by mergify[bot]
parent f20e35982b
commit 1295e37d4b
7 changed files with 25 additions and 25 deletions

View File

@ -61,7 +61,7 @@ SetBootNextDevice (
DpEnd = AppendDevicePathNode (NULL, NULL); DpEnd = AppendDevicePathNode (NULL, NULL);
if (DpEnd == NULL) { if (DpEnd == NULL) {
DEBUG ((DEBUG_ERROR, "%a: Unable to create device path. DpEnd is NULL.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a: Unable to create device path. DpEnd is NULL.\n", __func__));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto CLEANUP; goto CLEANUP;
} }
@ -72,7 +72,7 @@ SetBootNextDevice (
(EFI_DEVICE_PATH_PROTOCOL *)&UsbDp (EFI_DEVICE_PATH_PROTOCOL *)&UsbDp
); );
if (Dp == NULL) { if (Dp == NULL) {
DEBUG ((DEBUG_ERROR, "%a: Unable to create device path. Dp is NULL.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a: Unable to create device path. Dp is NULL.\n", __func__));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto CLEANUP; goto CLEANUP;
} }
@ -88,15 +88,15 @@ SetBootNextDevice (
OptionalDataSize OptionalDataSize
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Error creating load option. Status = %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a: Error creating load option. Status = %r\n", __func__, Status));
goto CLEANUP; goto CLEANUP;
} }
NewOptionValid = TRUE; NewOptionValid = TRUE;
DEBUG ((DEBUG_VERBOSE, "%a: Generic USB Class Device boot option created.\n", __FUNCTION__)); DEBUG ((DEBUG_VERBOSE, "%a: Generic USB Class Device boot option created.\n", __func__));
Status = EfiBootManagerLoadOptionToVariable (&NewOption); Status = EfiBootManagerLoadOptionToVariable (&NewOption);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status = %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status = %r\n", __func__, Status));
goto CLEANUP; goto CLEANUP;
} }
@ -111,7 +111,7 @@ SetBootNextDevice (
&(BootNextValue) &(BootNextValue)
); );
DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __FUNCTION__, Status)); DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __func__, Status));
CLEANUP: CLEANUP:
if (Dp != NULL) { if (Dp != NULL) {

View File

@ -118,7 +118,7 @@ UnitTestLogInit (
// Make sure that you're cooking with gas. // Make sure that you're cooking with gas.
// //
if (Test == NULL) { if (Test == NULL) {
DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __func__));
return; return;
} }

View File

@ -274,7 +274,7 @@ InitUnitTestFramework (
// //
// Don't actually report it as an error, but emit a warning. // Don't actually report it as an error, but emit a warning.
// //
DEBUG ((DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __func__));
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
} }
} }
@ -856,7 +856,7 @@ SaveFrameworkState (
// //
Status = SaveUnitTestCache (FrameworkHandle, Header, Header->SaveStateSize); Status = SaveUnitTestCache (FrameworkHandle, Header, Header->SaveStateSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", __func__, Status));
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
} }

View File

@ -61,7 +61,7 @@ GetCacheFileDevicePath (
(VOID **)&LoadedImage (VOID **)&LoadedImage
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __func__, Status));
return NULL; return NULL;
} }
@ -91,7 +91,7 @@ GetCacheFileDevicePath (
// Make sure we didn't get any weird data. // Make sure we didn't get any weird data.
// //
if (DirectorySlashOffset == 0) { if (DirectorySlashOffset == 0) {
DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app path.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app path.\n", __func__));
goto Exit; goto Exit;
} }
@ -112,7 +112,7 @@ GetCacheFileDevicePath (
// Let's check and make sure that's right. // Let's check and make sure that's right.
// //
if (AppPath[DirectorySlashOffset] != L'\\') { if (AppPath[DirectorySlashOffset] != L'\\') {
DEBUG ((DEBUG_ERROR, "%a - Could not find a single directory separator in app path.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a - Could not find a single directory separator in app path.\n", __func__));
goto Exit; goto Exit;
} }
@ -202,7 +202,7 @@ DoesCacheExist (
FreePool (FileDevicePath); FreePool (FileDevicePath);
} }
DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __FUNCTION__, !EFI_ERROR (Status))); DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __func__, !EFI_ERROR (Status)));
return (!EFI_ERROR (Status)); return (!EFI_ERROR (Status));
} }
@ -263,7 +263,7 @@ SaveUnitTestCache (
// //
Status = ShellDeleteFile (&FileHandle); Status = ShellDeleteFile (&FileHandle);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a failed to delete file %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a failed to delete file %r\n", __func__, Status));
} }
} }
@ -277,7 +277,7 @@ SaveUnitTestCache (
0 0
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __func__, Status));
goto Exit; goto Exit;
} }
@ -285,7 +285,7 @@ SaveUnitTestCache (
// Write the data to the file. // Write the data to the file.
// //
WriteCount = SaveStateSize; WriteCount = SaveStateSize;
DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __FUNCTION__, WriteCount)); DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __func__, WriteCount));
Status = ShellWriteFile ( Status = ShellWriteFile (
FileHandle, FileHandle,
&WriteCount, &WriteCount,
@ -293,9 +293,9 @@ SaveUnitTestCache (
); );
if (EFI_ERROR (Status) || (WriteCount != SaveStateSize)) { if (EFI_ERROR (Status) || (WriteCount != SaveStateSize)) {
DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __func__, Status));
} else { } else {
DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__)); DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __func__));
} }
// //
@ -368,7 +368,7 @@ LoadUnitTestCache (
0 0
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __func__, Status));
goto Exit; goto Exit;
} else { } else {
IsFileOpened = TRUE; IsFileOpened = TRUE;
@ -379,7 +379,7 @@ LoadUnitTestCache (
// //
Status = ShellGetFileSize (FileHandle, &LargeFileSize); Status = ShellGetFileSize (FileHandle, &LargeFileSize);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __func__, Status));
goto Exit; goto Exit;
} }
@ -390,7 +390,7 @@ LoadUnitTestCache (
*SaveStateSize = FileSize; *SaveStateSize = FileSize;
Buffer = AllocatePool (FileSize); Buffer = AllocatePool (FileSize);
if (Buffer == NULL) { if (Buffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the file contents! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the file contents! %r\n", __func__, Status));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Exit; goto Exit;
} }
@ -400,7 +400,7 @@ LoadUnitTestCache (
// //
Status = ShellReadFile (FileHandle, &FileSize, Buffer); Status = ShellReadFile (FileHandle, &FileSize, Buffer);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Failed to read the file contents! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Failed to read the file contents! %r\n", __func__, Status));
} }
Exit: Exit:

View File

@ -102,7 +102,7 @@ GetStringForFailureType (
// //
// Return last entry if no match found. // Return last entry if no match found.
// //
DEBUG ((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __FUNCTION__, (UINT32)Failure)); DEBUG ((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __func__, (UINT32)Failure));
return mFailureTypeStrings[Index].String; return mFailureTypeStrings[Index].String;
} }

View File

@ -25,7 +25,7 @@ ReportPrint (
VA_START (Marker, Format); VA_START (Marker, Format);
Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker); Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);
if (Length == 0) { if (Length == 0) {
DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__));
} else { } else {
gST->ConOut->OutputString (gST->ConOut, String); gST->ConOut->OutputString (gST->ConOut, String);
} }

View File

@ -24,7 +24,7 @@ ReportPrint (
VA_START (Marker, Format); VA_START (Marker, Format);
Length = AsciiVSPrint (String, sizeof (String), Format, Marker); Length = AsciiVSPrint (String, sizeof (String), Format, Marker);
if (Length == 0) { if (Length == 0) {
DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__));
} else { } else {
DEBUG ((DEBUG_INFO, String)); DEBUG ((DEBUG_INFO, String));
} }