]> xenbits.xensource.com Git - ovmf.git/commitdiff
UnitTestFrameworkPkg: Update to be more C11 compliant by using __func__
authorRebecca Cran <rebecca@bsdio.com>
Thu, 6 Apr 2023 19:51:51 +0000 (13:51 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 10 Apr 2023 14:19:57 +0000 (14:19 +0000)
__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>
UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c
UnitTestFrameworkPkg/Library/UnitTestLib/Log.c
UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c

index ebb42186a534a13021cf9fe8a1b54173b9340b04..b9b2d23eb14d6d154dd3a1ce4ae533a9d4318e36 100644 (file)
@@ -61,7 +61,7 @@ SetBootNextDevice (
 \r
   DpEnd = AppendDevicePathNode (NULL, NULL);\r
   if (DpEnd == NULL) {\r
-    DEBUG ((DEBUG_ERROR, "%a: Unable to create device path.  DpEnd is NULL.\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a: Unable to create device path.  DpEnd is NULL.\n", __func__));\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto CLEANUP;\r
   }\r
@@ -72,7 +72,7 @@ SetBootNextDevice (
          (EFI_DEVICE_PATH_PROTOCOL *)&UsbDp\r
          );\r
   if (Dp == NULL) {\r
-    DEBUG ((DEBUG_ERROR, "%a: Unable to create device path.  Dp is NULL.\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a: Unable to create device path.  Dp is NULL.\n", __func__));\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto CLEANUP;\r
   }\r
@@ -88,15 +88,15 @@ SetBootNextDevice (
              OptionalDataSize\r
              );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a: Error creating load option.  Status = %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a: Error creating load option.  Status = %r\n", __func__, Status));\r
     goto CLEANUP;\r
   }\r
 \r
   NewOptionValid = TRUE;\r
-  DEBUG ((DEBUG_VERBOSE, "%a: Generic USB Class Device boot option created.\n", __FUNCTION__));\r
+  DEBUG ((DEBUG_VERBOSE, "%a: Generic USB Class Device boot option created.\n", __func__));\r
   Status = EfiBootManagerLoadOptionToVariable (&NewOption);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status = %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status = %r\n", __func__, Status));\r
     goto CLEANUP;\r
   }\r
 \r
@@ -111,7 +111,7 @@ SetBootNextDevice (
                   &(BootNextValue)\r
                   );\r
 \r
-  DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __FUNCTION__, Status));\r
+  DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __func__, Status));\r
 \r
 CLEANUP:\r
   if (Dp != NULL) {\r
index 3998aafdf84330bccad452ed859c75e4931fc1f9..19eb8ee0db6eff71df864e5ba09d523930460dcb 100644 (file)
@@ -118,7 +118,7 @@ UnitTestLogInit (
   // Make sure that you're cooking with gas.\r
   //\r
   if (Test == NULL) {\r
-    DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __func__));\r
     return;\r
   }\r
 \r
index 5b442ed122ea1d3fc5f4a1a79829fff07f4413ab..322ea15b15752df2d6eb0411dfe2d34beb294ad2 100644 (file)
@@ -274,7 +274,7 @@ InitUnitTestFramework (
       //\r
       // Don't actually report it as an error, but emit a warning.\r
       //\r
-      DEBUG ((DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __FUNCTION__));\r
+      DEBUG ((DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __func__));\r
       Status = EFI_SUCCESS;\r
     }\r
   }\r
@@ -856,7 +856,7 @@ SaveFrameworkState (
   //\r
   Status = SaveUnitTestCache (FrameworkHandle, Header, Header->SaveStateSize);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", __func__, Status));\r
     Status = EFI_DEVICE_ERROR;\r
   }\r
 \r
index d7a62145dac6ab5cd5e7aced068b9ca8337e7a94..b59991683f48b7649e7b71e3ace746e6b2a26389 100644 (file)
@@ -61,7 +61,7 @@ GetCacheFileDevicePath (
                   (VOID **)&LoadedImage\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __func__, Status));\r
     return NULL;\r
   }\r
 \r
@@ -91,7 +91,7 @@ GetCacheFileDevicePath (
   // Make sure we didn't get any weird data.\r
   //\r
   if (DirectorySlashOffset == 0) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app path.\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app path.\n", __func__));\r
     goto Exit;\r
   }\r
 \r
@@ -112,7 +112,7 @@ GetCacheFileDevicePath (
   // Let's check and make sure that's right.\r
   //\r
   if (AppPath[DirectorySlashOffset] != L'\\') {\r
-    DEBUG ((DEBUG_ERROR, "%a - Could not find a single directory separator in app path.\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a - Could not find a single directory separator in app path.\n", __func__));\r
     goto Exit;\r
   }\r
 \r
@@ -202,7 +202,7 @@ DoesCacheExist (
     FreePool (FileDevicePath);\r
   }\r
 \r
-  DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __FUNCTION__, !EFI_ERROR (Status)));\r
+  DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __func__, !EFI_ERROR (Status)));\r
 \r
   return (!EFI_ERROR (Status));\r
 }\r
@@ -263,7 +263,7 @@ SaveUnitTestCache (
     //\r
     Status = ShellDeleteFile (&FileHandle);\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_ERROR, "%a failed to delete file %r\n", __FUNCTION__, Status));\r
+      DEBUG ((DEBUG_ERROR, "%a failed to delete file %r\n", __func__, Status));\r
     }\r
   }\r
 \r
@@ -277,7 +277,7 @@ SaveUnitTestCache (
              0\r
              );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __func__, Status));\r
     goto Exit;\r
   }\r
 \r
@@ -285,7 +285,7 @@ SaveUnitTestCache (
   // Write the data to the file.\r
   //\r
   WriteCount = SaveStateSize;\r
-  DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __FUNCTION__, WriteCount));\r
+  DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __func__, WriteCount));\r
   Status = ShellWriteFile (\r
              FileHandle,\r
              &WriteCount,\r
@@ -293,9 +293,9 @@ SaveUnitTestCache (
              );\r
 \r
   if (EFI_ERROR (Status) || (WriteCount != SaveStateSize)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __func__, Status));\r
   } else {\r
-    DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __func__));\r
   }\r
 \r
   //\r
@@ -368,7 +368,7 @@ LoadUnitTestCache (
              0\r
              );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __func__, Status));\r
     goto Exit;\r
   } else {\r
     IsFileOpened = TRUE;\r
@@ -379,7 +379,7 @@ LoadUnitTestCache (
   //\r
   Status = ShellGetFileSize (FileHandle, &LargeFileSize);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __func__, Status));\r
     goto Exit;\r
   }\r
 \r
@@ -390,7 +390,7 @@ LoadUnitTestCache (
   *SaveStateSize = FileSize;\r
   Buffer         = AllocatePool (FileSize);\r
   if (Buffer == NULL) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the file contents! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the file contents! %r\n", __func__, Status));\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Exit;\r
   }\r
@@ -400,7 +400,7 @@ LoadUnitTestCache (
   //\r
   Status = ShellReadFile (FileHandle, &FileSize, Buffer);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_ERROR, "%a - Failed to read the file contents! %r\n", __FUNCTION__, Status));\r
+    DEBUG ((DEBUG_ERROR, "%a - Failed to read the file contents! %r\n", __func__, Status));\r
   }\r
 \r
 Exit:\r
index d088b927a6c298694f067d4128dc6c6953e42e30..5e2973beb3e1cbd9ad4b15ca283dbbc361504762 100644 (file)
@@ -102,7 +102,7 @@ GetStringForFailureType (
   //\r
   // Return last entry if no match found.\r
   //\r
-  DEBUG ((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __FUNCTION__, (UINT32)Failure));\r
+  DEBUG ((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __func__, (UINT32)Failure));\r
   return mFailureTypeStrings[Index].String;\r
 }\r
 \r
index aba00fe7b962cc77c49d407234550f69be8ce29a..3bcbf557a1682daf9f420659d9bdbc6348ee5e18 100644 (file)
@@ -25,7 +25,7 @@ ReportPrint (
   VA_START (Marker, Format);\r
   Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);\r
   if (Length == 0) {\r
-    DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__));\r
   } else {\r
     gST->ConOut->OutputString (gST->ConOut, String);\r
   }\r
index ac330861fd402463e9f05f406afc85358dd9b4c8..eb78554f9101ba3dd5e621caee0f27ff074820f8 100644 (file)
@@ -24,7 +24,7 @@ ReportPrint (
   VA_START (Marker, Format);\r
   Length = AsciiVSPrint (String, sizeof (String), Format, Marker);\r
   if (Length == 0) {\r
-    DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__));\r
+    DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__));\r
   } else {\r
     DEBUG ((DEBUG_INFO, String));\r
   }\r