From nobody Tue Feb 10 12:42:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+102640+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102640+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1680819853; cv=none; d=zohomail.com; s=zohoarc; b=AbTwlxhriA3VUlMB16I71EYfsFtPD0D6c19ZTVs3frWcQ8A2ZaPJgcZhEWrJpKm1z+rjrGxpMr91RO/XYQ9vnAiY20RNAPLNC1wP8W8QE5OBZjnXiEeO4lIaS9Np5VWAZtgaqSNKCAB86d45qwL1hl25D+35VTg6O/6J+s4ITd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680819853; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=sehi0TvHmmaTfKCWoJ4h5WVnwYA91YNzz/RB0sVpfqA=; b=aBZPIA9keRP9IUXRL7v8ef9sxMROVg46GEEsONY5cEZcpKsIrt0Qbm1xRRANiWn0hoF+k8+O0XNclV43m8EHKluX0eK7BC1l6jZfY5eg9bRkmoF+UA4Jq7+ulVndzfHsSCc4A7bES8RwIkJgjyi4LqcDVSlZlHxnP/6Cl/0NIFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102640+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1680819853495156.89300287570927; Thu, 6 Apr 2023 15:24:13 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 32ptYY1788612xmldSgJigcE; Thu, 06 Apr 2023 15:24:13 -0700 X-Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mx.groups.io with SMTP id smtpd.web10.171999.1680819852470523795 for ; Thu, 06 Apr 2023 15:24:12 -0700 X-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C797E5C01E3; Thu, 6 Apr 2023 18:24:11 -0400 (EDT) X-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 06 Apr 2023 18:24:11 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejgedgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptfgvsggv tggtrgcuvehrrghnuceorhgvsggvtggtrgessghsughiohdrtghomheqnecuggftrfgrth htvghrnhepgeffueeuledvgefgvddvgfetvdduhfefkedukeeikedtudekfeetteeifedv leefnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrhhomheprh gvsggvtggtrgessghsughiohdrtghomh X-ME-Proxy: Feedback-ID: i5b994698:Fastmail X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Apr 2023 18:24:08 -0400 (EDT) From: "Rebecca Cran" To: devel@edk2.groups.io, Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu , Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo , Andrew Fish , Hao A Wu , Maciej Rabeda , Siyuan Fu , Jiewen Yao , Jian J Wang , Xiaoyu Lu , Ard Biesheuvel , Sami Mujawar , Supreeth Venkatesh , Michael Kubacki , Nate DeSimone , Sean Brogan Cc: Rebecca Cran , Leif Lindholm , Abner Chang , Nickle Wang , Igor Kulchytskyy , Daniel Schaefer , Min Xu , Jordan Justen , Gerd Hoffmann , Peter Grehan , Erdem Aktas , James Bottomley , Tom Lendacky , Michael Roth , Sunil V L , Andrei Warkentin Subject: [edk2-devel] [PATCH 10/18] UnitTestFrameworkPkg: Update to be more C11 compliant by using __func__ Date: Thu, 6 Apr 2023 16:23:11 -0600 Message-Id: <20230406222319.2281263-11-rebecca@bsdio.com> In-Reply-To: <20230406222319.2281263-1-rebecca@bsdio.com> References: <20230406222319.2281263-1-rebecca@bsdio.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rebecca@bsdio.com X-Gm-Message-State: oD8rvegA8M6vKsU1LhO6RLQ9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680819853; bh=5x6h8nJZlk5H2m0iueBjPBbdrquc87kyHepV+QaDsxM=; h=Cc:Date:From:Reply-To:Subject:To; b=irzLeFTAiNQrECDLDL2ymFNt+8VmLAr0+ccqt2s+fbzuSzofTlRQ0AJH+4zLQ1YtJNc UwpweOx4/ABFZgrxqr7gzzsL8SdllK/n+DZ8V6BV7adFYdDvkqRiFsUr1VtwSuFv0mcg6 iDYfQEAqbPoHtrgNz+5l8Mtztbn3tmIVApg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680819855348100001 Content-Type: text/plain; charset="utf-8" __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. 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 --- UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbCla= ss.c | 12 ++++----- UnitTestFrameworkPkg/Library/UnitTestLib/Log.c = | 2 +- UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c = | 4 +-- UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTe= stPersistenceLibSimpleFileSystem.c | 26 ++++++++++---------- UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportL= ib.c | 2 +- UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportL= ibConOut.c | 2 +- UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportL= ibDebugLib.c | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestB= ootLibUsbClass.c b/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/Uni= tTestBootLibUsbClass.c index ebb42186a534..b9b2d23eb14d 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibU= sbClass.c +++ b/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibU= sbClass.c @@ -61,7 +61,7 @@ SetBootNextDevice ( =20 DpEnd =3D AppendDevicePathNode (NULL, NULL); if (DpEnd =3D=3D 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 =3D EFI_OUT_OF_RESOURCES; goto CLEANUP; } @@ -72,7 +72,7 @@ SetBootNextDevice ( (EFI_DEVICE_PATH_PROTOCOL *)&UsbDp ); if (Dp =3D=3D 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 =3D EFI_OUT_OF_RESOURCES; goto CLEANUP; } @@ -88,15 +88,15 @@ SetBootNextDevice ( OptionalDataSize ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Error creating load option. Status =3D %r\n= ", __FUNCTION__, Status)); + DEBUG ((DEBUG_ERROR, "%a: Error creating load option. Status =3D %r\n= ", __func__, Status)); goto CLEANUP; } =20 NewOptionValid =3D 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 =3D EfiBootManagerLoadOptionToVariable (&NewOption); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status= =3D %r\n", __FUNCTION__, Status)); + DEBUG ((DEBUG_ERROR, "%a: Error Saving boot option NV variable. Status= =3D %r\n", __func__, Status)); goto CLEANUP; } =20 @@ -111,7 +111,7 @@ SetBootNextDevice ( &(BootNextValue) ); =20 - DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __FUNCTION__, = Status)); + DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __func__, Stat= us)); =20 CLEANUP: if (Dp !=3D NULL) { diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c b/UnitTestFrame= workPkg/Library/UnitTestLib/Log.c index 3998aafdf843..19eb8ee0db6e 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c @@ -118,7 +118,7 @@ UnitTestLogInit ( // Make sure that you're cooking with gas. // if (Test =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __FUNC= TION__)); + DEBUG ((DEBUG_ERROR, "%a called with invalid Test parameter\n", __func= __)); return; } =20 diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c b/UnitT= estFrameworkPkg/Library/UnitTestLib/UnitTestLib.c index 5b442ed122ea..322ea15b1575 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c @@ -274,7 +274,7 @@ InitUnitTestFramework ( // // 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 =3D EFI_SUCCESS; } } @@ -856,7 +856,7 @@ SaveFrameworkState ( // Status =3D SaveUnitTestCache (FrameworkHandle, Header, Header->SaveState= Size); 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__, Stat= us)); Status =3D EFI_DEVICE_ERROR; } =20 diff --git a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileS= ystem/UnitTestPersistenceLibSimpleFileSystem.c b/UnitTestFrameworkPkg/Libra= ry/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileS= ystem.c index d7a62145dac6..b59991683f48 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/U= nitTestPersistenceLibSimpleFileSystem.c +++ b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/U= nitTestPersistenceLibSimpleFileSystem.c @@ -61,7 +61,7 @@ GetCacheFileDevicePath ( (VOID **)&LoadedImage ); 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; } =20 @@ -91,7 +91,7 @@ GetCacheFileDevicePath ( // Make sure we didn't get any weird data. // if (DirectorySlashOffset =3D=3D 0) { - DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app p= ath.\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a - Weird 0-length string when processing app p= ath.\n", __func__)); goto Exit; } =20 @@ -112,7 +112,7 @@ GetCacheFileDevicePath ( // Let's check and make sure that's right. // if (AppPath[DirectorySlashOffset] !=3D 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; } =20 @@ -202,7 +202,7 @@ DoesCacheExist ( FreePool (FileDevicePath); } =20 - DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __FUNCTION__, !EFI_ERROR (= Status))); + DEBUG ((DEBUG_VERBOSE, "%a - Returning %d\n", __func__, !EFI_ERROR (Stat= us))); =20 return (!EFI_ERROR (Status)); } @@ -263,7 +263,7 @@ SaveUnitTestCache ( // Status =3D ShellDeleteFile (&FileHandle); 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__, Stat= us)); } } =20 @@ -277,7 +277,7 @@ SaveUnitTestCache ( 0 ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __F= UNCTION__, Status)); + DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __f= unc__, Status)); goto Exit; } =20 @@ -285,7 +285,7 @@ SaveUnitTestCache ( // Write the data to the file. // WriteCount =3D SaveStateSize; - DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __FUNCTION__, = WriteCount)); + DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __func__, Writ= eCount)); Status =3D ShellWriteFile ( FileHandle, &WriteCount, @@ -293,9 +293,9 @@ SaveUnitTestCache ( ); =20 if (EFI_ERROR (Status) || (WriteCount !=3D SaveStateSize)) { - DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __FUNCTION__= , Status)); + DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __func__, St= atus)); } else { - DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __func__)); } =20 // @@ -368,7 +368,7 @@ LoadUnitTestCache ( 0 ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __F= UNCTION__, Status)); + DEBUG ((DEBUG_ERROR, "%a - Opening file for writing failed! %r\n", __f= unc__, Status)); goto Exit; } else { IsFileOpened =3D TRUE; @@ -379,7 +379,7 @@ LoadUnitTestCache ( // Status =3D ShellGetFileSize (FileHandle, &LargeFileSize); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __FUN= CTION__, Status)); + DEBUG ((DEBUG_ERROR, "%a - Failed to determine file size! %r\n", __fun= c__, Status)); goto Exit; } =20 @@ -390,7 +390,7 @@ LoadUnitTestCache ( *SaveStateSize =3D FileSize; Buffer =3D AllocatePool (FileSize); if (Buffer =3D=3D 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 =3D EFI_OUT_OF_RESOURCES; goto Exit; } @@ -400,7 +400,7 @@ LoadUnitTestCache ( // Status =3D ShellReadFile (FileHandle, &FileSize, Buffer); 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)); } =20 Exit: diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestR= esultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/Uni= tTestResultReportLib.c index d088b927a6c2..5e2973beb3e1 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLib.c +++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLib.c @@ -102,7 +102,7 @@ GetStringForFailureType ( // // 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; } =20 diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestR= esultReportLibConOut.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportL= ib/UnitTestResultReportLibConOut.c index aba00fe7b962..3bcbf557a168 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibConOut.c +++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibConOut.c @@ -25,7 +25,7 @@ ReportPrint ( VA_START (Marker, Format); Length =3D UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, M= arker); if (Length =3D=3D 0) { - DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__= )); + DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__)); } else { gST->ConOut->OutputString (gST->ConOut, String); } diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestR= esultReportLibDebugLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultRepor= tLib/UnitTestResultReportLibDebugLib.c index ac330861fd40..eb78554f9101 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibDebugLib.c +++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRe= portLibDebugLib.c @@ -24,7 +24,7 @@ ReportPrint ( VA_START (Marker, Format); Length =3D AsciiVSPrint (String, sizeof (String), Format, Marker); if (Length =3D=3D 0) { - DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__= )); + DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__)); } else { DEBUG ((DEBUG_INFO, String)); } --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102640): https://edk2.groups.io/g/devel/message/102640 Mute This Topic: https://groups.io/mt/98115246/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-