From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9C4D6740034 for ; Tue, 2 Apr 2024 01:09:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ofky2Pbm90b/8hRWUXMSqesrBy7yCSttHkAYehnRTZ0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Language; s=20240206; t=1712020154; v=1; b=adLsZCvFPDmnc5/U3KhtshXIQPxUNnQgODzejOXgdPwxSnM4SiSb7D+/3tzL8Xv39hOek1oa nMS0Ruq40pb5Zx7JSWBB+tKYoo/PH6Z9BN55Asnx3BOZonO/7G2s5u/rI5ipFc+23iwTnSIPfC7 AKtUjfZeaiIqb0+Rn/2Hbc++jAhO/JwmhPXYarht8uWhnGlcakLCMnEgmxxGDTHUUggflUNtw7v jMR3lbALWqPxhkeeIXGSqIwn4yfbEwEqfXI1kGnAp5b0lYU+1p7kHluSGFLh80BEhq8IWRa9yPR uQuCGnj/34cC8gcn8zXF73X+sQyHwJKS1J+yFBGyqvwyg== X-Received: by 127.0.0.2 with SMTP id tw4RYY7687511xYitUtcT4VP; Mon, 01 Apr 2024 18:09:14 -0700 X-Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web10.1923.1712020152486076487 for ; Mon, 01 Apr 2024 18:09:13 -0700 X-Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 459BDA32DFF4 for ; Tue, 2 Apr 2024 09:09:10 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 29B27A32DFEC for ; Tue, 2 Apr 2024 09:09:10 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 436C1A32DFC4 for ; Tue, 2 Apr 2024 09:09:06 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Tue, 02 Apr 2024 09:09:04 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: , , "'Yang, Yuting2'" Cc: "'Chen, Christine'" , "'Feng, Bob C'" , "'He, Haiyang'" References: <17BEB716C0DD8A75.2828@groups.io> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BhdGNoIFY0XSBCYXNlVG9vbHM6IFZmckNvbXBpbGVyIEFkZHMgRGVmYXVsdFZhbHVlRXJyb3I=?= Date: Tue, 2 Apr 2024 09:09:06 +0800 Message-ID: <017701da849a$5c472f50$14d58df0$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQJYNkJzReM8gTWYV0qsSknjroW/1wGnsciHAdycraWwPKU1cA== Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 01 Apr 2024 18:09:13 -0700 Resent-From: gaoliming@byosoft.com.cn Reply-To: devel@edk2.groups.io,gaoliming@byosoft.com.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: jGVc6Guok4vZJc9XE1ZCcmaJx7686176AA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=adLsZCvF; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Zifang and Yuting: The change looks good. But, there are two ways for error report. One is gCVfrErrorHandle.HandleWarning, another is DefaultValueError. Can we always use gCVfrErrorHandle.HandleWarning? Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Zhang, Zifeng > =B7=A2=CB=CD=CA=B1=BC=E4: 2024=C4=EA3=D4=C228=C8=D5 15:29 > =CA=D5=BC=FE=C8=CB: Yang, Yuting2 ; devel@edk2.gr= oups.io; > gaoliming > =B3=AD=CB=CD: Chen, Christine ; Feng, Bob C > ; He, Haiyang > =D6=F7=CC=E2: Re: [edk2-devel] [Patch V4] BaseTools: VfrCompiler Adds > DefaultValueError >=20 > Thanks Yuting for patch update! >=20 > Hi @gaoliming, > Would you like to review the V4 patch? > Hope to merge it asap to avoid blocking feature complete. >=20 > Best Regards, > Zifeng >=20 > -----Original Message----- > From: Yang, Yuting2 > Sent: Thursday, March 21, 2024 3:54 PM > To: devel@edk2.groups.io; gaoliming > Cc: Chen, Christine ; Zhang, Zifeng > ; Feng, Bob C ; He, Haiyang > > Subject: RE: [edk2-devel] [Patch V4] BaseTools: VfrCompiler Adds > DefaultValueError >=20 > Hi liming, >=20 > Gentle reminder, we have removed the whitespace. Please help review the > patch~ >=20 > Thanks, > Yuting >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Yuting > Yang > Sent: Thursday, March 21, 2024 3:30 PM > To: devel@edk2.groups.io > Cc: Rebecca Cran ; Liming Gao > ; Feng, Bob C ; Chen, > Christine ; Zhang, Zifeng > Subject: [edk2-devel] [Patch V4] BaseTools: VfrCompiler Adds > DefaultValueError >=20 > Add --catch_default option > Raise a DefaultValueError when encountering VFR default definitions to help > remove default variables. >=20 > Signed-off-by: Yuting Yang >=20 > Cc: Rebecca Cran > Cc: Liming Gao > Cc: Bob Feng > Cc: Christine Chen > Cc: Zifeng Zhang > --- > BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 8 ++++---- > BaseTools/Source/C/VfrCompile/VfrCompiler.h | 1 + > BaseTools/Source/C/VfrCompile/VfrError.cpp | 3 ++- > BaseTools/Source/C/VfrCompile/VfrError.h | 3 ++- > BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 1 + > BaseTools/Source/C/VfrCompile/VfrSyntax.g | 58 > ++++++++++++++++++++++++++++++++++++++++++++++++++-------- > 6 files changed, 60 insertions(+), 14 deletions(-) >=20 > diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > index 5f4d262d85..4031af6e39 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp > @@ -78,6 +78,7 @@ CVfrCompiler::OptionInitialization ( > mOptions.WarningAsError =3D FALSE; > mOptions.AutoDefault =3D FALSE; > mOptions.CheckDefault =3D FALSE;+ > mOptions.IsCatchDefaultEnable =3D FALSE; memset > (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID)); if (Argc =3D=3D 1= ) {@@ > -95,6 +96,8 @@ CVfrCompiler::OptionInitialization ( > Version (); SET_RUN_STATUS (STATUS_DEAD); > return;+ } else if (stricmp(Argv[Index], "--catch_default") =3D=3D 0){= + > mOptions.IsCatchDefaultEnable =3D TRUE; } else if (stricmp(Argv[Index= ], > "-l") =3D=3D 0) { mOptions.CreateRecordListFile =3D TRUE; > gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +182,6 @@ > CVfrCompiler::OptionInitialization ( > goto Fail; } strcpy (mOptions.VfrFileName, Argv[Index]);- > if (mOptions.OutputDirectory =3D=3D NULL) { mOptions.OutputDirector= y =3D > (CHAR8 *) malloc (1); if (mOptions.OutputDirectory =3D=3D NULL) {@@ > -679,7 +681,7 @@ CVfrCompiler::Compile ( > DebugError (NULL, 0, 0001, "Error opening the input file", "%s", > InFileName); goto Fail; }-+ InputInfo.IsCatchDefaultEnable =3D > mOptions.IsCatchDefaultEnable; if (mOptions.HasOverrideClassGuid) > { InputInfo.OverrideClassGuid =3D &mOptions.OverrideClassGuid; } el= se > {@@ -937,5 +939,3 @@ main ( > return GetUtilityStatus (); }--diff --git > a/BaseTools/Source/C/VfrCompile/VfrCompiler.h > b/BaseTools/Source/C/VfrCompile/VfrCompiler.h > index b6e207d2ce..974f37c4eb 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h > +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h > @@ -52,6 +52,7 @@ typedef struct { > BOOLEAN WarningAsError; BOOLEAN AutoDefault; BOOLEAN > CheckDefault;+ BOOLEAN IsCatchDefaultEnable; } OPTIONS; typedef > enum {diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp > b/BaseTools/Source/C/VfrCompile/VfrError.cpp > index 65bb8e34fd..8a706f929b 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp > @@ -49,7 +49,8 @@ static SVFR_WARNING_HANDLE > VFR_WARNING_HANDLE_TABLE [] =3D { > { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value > re-defined with different value"}, > { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action opcode should not > have TextTwo part"}, > { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to > use obsoleted framework opcode"},- { VFR_WARNING_CODEUNDEFINED, ": > undefined Warning Code" }+ { VFR_WARNING_CODEUNDEFINED, ": > undefined Warning Code" },+ { VFR_WARNING_UNSUPPORTED, ": pls > remove the default values if necessary" } }; > CVfrErrorHandle::CVfrErrorHandle (diff --git > a/BaseTools/Source/C/VfrCompile/VfrError.h > b/BaseTools/Source/C/VfrCompile/VfrError.h > index 7d16bd5f74..1b4bc173d2 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrError.h > +++ b/BaseTools/Source/C/VfrCompile/VfrError.h > @@ -47,7 +47,8 @@ typedef enum { > VFR_WARNING_DEFAULT_VALUE_REDEFINED =3D 0, > VFR_WARNING_ACTION_WITH_TEXT_TWO, > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,- > VFR_WARNING_CODEUNDEFINED+ VFR_WARNING_CODEUNDEFINED,+ > VFR_WARNING_UNSUPPORTED } EFI_VFR_WARNING_CODE; typedef > struct _SVFR_ERROR_HANDLE {diff --git > a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h > b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h > index 9ef6f07787..d8fada3bcb 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h > +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h > @@ -96,6 +96,7 @@ struct SBufferNode { > typedef struct { EFI_GUID *OverrideClassGuid;+ BOOLEAN > IsCatchDefaultEnable; } INPUT_INFO_TO_SYNTAX; class CFormPkg {diff --git > a/BaseTools/Source/C/VfrCompile/VfrSyntax.g > b/BaseTools/Source/C/VfrCompile/VfrSyntax.g > index 55fd067f8a..d7376122d8 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g > +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g > @@ -50,6 +50,7 @@ VfrParserStart ( > { ParserBlackBox > VfrParser(File); VfrParser.parser()->SetOverrideClassGuid > (InputInfo->OverrideClassGuid);+ > VfrParser.parser()->SetIsCatchDefaultEnable(InputInfo->IsCatchDefaultEnable > ); return VfrParser.parser()->vfrProgram(); } >>@@ -975,7 +976,15 @@ > vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 > TypeSize, > vfrStatementDefaultStore : << UINT16 DefaultId =3D > EFI_HII_DEFAULT_CLASS_STANDARD; >>- D:DefaultStore N:StringIdentifier > ","+ D:DefaultStore N:StringIdentifier "," <<+ > if (mIsCatchDefaultEnable) {+ > gCVfrErrorHandle.HandleWarning (+ > VFR_WARNING_UNSUPPORTED,+ > D->getLine(),+ > D->getText()+ > );+ > }+ >> > Prompt "=3D" "STRING_TOKEN" "\(" S:Number "\)" { "," Attribute "=3D= " > A:Number << DefaultId =3D _STOU16(A->getText(), > A->getLine()); >>@@ -1775,7 +1784,11 @@ vfrStatementDefault : > CIfrNumeric *NumericQst =3D NULL; >>- > D:Default + D:Default > <<+ if > (mIsCatchDefaultEnable) {+ > DefaultValueError(VFR_RETURN_UNSUPPORTED, > D->getLine());+ > }+ >> > ( ( "=3D" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), > *Val, ArrayType] "," @@ -1970,11 +1983,15 @@ vfrStatementInvalid : > ; flagsField :- Number - | InteractiveFlag - | ManufacturingFlag - > | DefaultFlag - | ResetRequiredFlag + Number+ | InteractiveFlag+ | > ManufacturingFlag+ | D:DefaultFlag > <<+ if > (mIsCatchDefaultEnable) {+ > DefaultValueError(VFR_RETURN_UNSUPPORTED, > D->getLine());+ > }+ > >>+ | ResetRequiredFlag | ReconnectRequiredFlag | > N:NVAccessFlag << > gCVfrErrorHandle.HandleWarning (@@ -3790,7 +3807,12 @@ > oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] : > | RestStyleFlag << $HFlags > |=3D 0x20; >> | ReconnectRequiredFlag > << $HFlags |=3D 0x40; >> | ManufacturingFlag > << $LFlags |=3D 0x20; >>- | DefaultFlag > << $LFlags |=3D 0x10; >>+ | D:DefaultFlag > <<+ > $LFlags |=3D 0x10;+ > if (mIsCatchDefaultEnable) {+ > DefaultValueError(VFR_RETURN_UNSUPPORTED, > D->getLine());+ > }+ > >> | A:NVAccessFlag > << > gCVfrErrorHandle.HandleWarning > ( > VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,@@ -4837,6 +4859,7 > @@ spanFlags [UINT8 & Flags] : > class EfiVfrParser { << private:+ BOOLEAN > mIsCatchDefaultEnable; UINT8 mParserStatus; > BOOLEAN mConstantOnlyInExpression; @@ -4880,6 +4903,7 > @@ public: > VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN > ANTLRTokenPtr); VOID _PCATCH (IN > EFI_VFR_RETURN_CODE, IN UINT32); VOID _PCATCH > (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);+ VOID > DefaultValueError (IN EFI_VFR_RETURN_CODE, IN UINT32); VOID > syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, > ANTLRTokenType, INT32); @@ -4909,6 +4933,7 @@ public: > VOID IdEqIdDoSpecial (IN UINT32 &, IN > UINT32, IN EFI_QUESTION_ID, IN CHAR8 *, IN UINT32, IN EFI_QUESTION_ID, > IN CHAR8 *, IN UINT32, IN EFI_COMPARE_TYPE); VOID > IdEqListDoSpecial (IN UINT32 &, IN UINT32, IN EFI_QUESTION_ID, IN > CHAR8 *, IN UINT32, IN UINT16, IN UINT16 *); VOID > SetOverrideClassGuid (IN EFI_GUID *);+ VOID > SetIsCatchDefaultEnable (BOOLEAN IsCatchDefaultEnable); >> } @@ -5086,6 > +5111,17 @@ EfiVfrParser::_PCATCH ( > mParserStatus =3D mParserStatus + gCVfrErrorHandle.HandleError > (ReturnCode, LineNum, (CHAR8 *) ErrorMsg); } > +VOID+EfiVfrParser::DefaultValueError (+ IN EFI_VFR_RETURN_CODE > ReturnCode,+ IN UINT32 LineNum+ )+{+ CHAR8 > ErrorMsg[100];+ sprintf(ErrorMsg, "please remove the default value / > defaultstore in line %d", LineNum);+ mParserStatus =3D mParserStatus + > gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg);+}+ VOID > EfiVfrParser::syn ( ANTLRAbstractToken *Tok,@@ -5688,6 +5724,12 @@ > EfiVfrParser::SetOverrideClassGuid (IN EFI_GUID *OverrideClassGuid) > mOverrideClassGuid =3D OverrideClassGuid; } > +VOID+EfiVfrParser::SetIsCatchDefaultEnable (BOOLEAN > IsCatchDefaultEnable)+{+ mIsCatchDefaultEnable =3D > IsCatchDefaultEnable;+}+ VOID EfiVfrParser::CheckDuplicateDefaultValue > ( IN EFI_DEFAULT_ID DefaultId,-- > 2.39.1.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#116948): > https://edk2.groups.io/g/devel/message/116948 > Mute This Topic: https://groups.io/mt/105061128/7976666 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuting2.yang@intel.com= ] > -=3D-=3D-=3D-=3D-=3D-=3D >=20 >=20 >=20 >=20 >=20 >=20 -=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 (#117300): https://edk2.groups.io/g/devel/message/117300 Mute This Topic: https://groups.io/mt/105279854/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-