From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5AD192202E4AE for ; Wed, 28 Mar 2018 13:15:49 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 13:22:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,373,1517904000"; d="scan'208";a="29711426" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 28 Mar 2018 13:22:26 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.89]) by FMSMSX108.amr.corp.intel.com ([169.254.9.102]) with mapi id 14.03.0319.002; Wed, 28 Mar 2018 13:22:26 -0700 From: "Carsey, Jaben" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [PATCH v1 1/4] BaseTools: remove irrelevant code Thread-Index: AQHTxjrvbrKuO0k7tk+fePP2RpOKfqPlvTiQgABbLLA= Date: Wed, 28 Mar 2018 20:22:25 +0000 Message-ID: References: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTdhNTZhMTctZDJmZS00YmFkLTk5NGEtNTVlNWQ5ZjlkYWYzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjdBSVdGT0dEdzNzaDVVbWh4cSs2bUwzWXNPMVNcL2pQYmNIeFNhb2EwRUNNPSJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [PATCH v1 1/4] BaseTools: remove irrelevant code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 20:15:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhu, I see what you meant. Please ignore this patch. -Jaben > -----Original Message----- > From: Carsey, Jaben > Sent: Wednesday, March 28, 2018 7:58 AM > To: Zhu, Yonghong ; edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: RE: [PATCH v1 1/4] BaseTools: remove irrelevant code >=20 > Zhu, >=20 > Given that the statement ~1 line above "PcdValue =3D PcdValue.strip()" wi= ll > raise exception with a PcdValue that is a list, I don't see how this code= could > execute. >=20 > I agree that it is likely that we think we want this, but something is wr= ong > with it and I assumed that the current behavior was the desired behavior.= If I > am incorrect, please feel free to disregard this patch. >=20 > -Jaben >=20 > > -----Original Message----- > > From: Zhu, Yonghong > > Sent: Tuesday, March 27, 2018 7:18 PM > > To: Carsey, Jaben ; edk2-devel@lists.01.org > > Cc: Gao, Liming ; Zhu, Yonghong > > > > Subject: RE: [PATCH v1 1/4] BaseTools: remove irrelevant code > > Importance: High > > > > Hi Jaben, > > > > Current we support flexible PCD value format, example: UINT64 type PCD > > can use {0x1, 2, 'A', UINT16(10), "B"} as its value, so the block can't= be > > removed since it maybe a list after SplitPcdValueString function. > > https://bugzilla.tianocore.org/show_bug.cgi?id=3D541 is the feature req= uest > > for flexible Pcd value format. > > > > Best Regards, > > Zhu Yonghong > > > > > > -----Original Message----- > > From: Carsey, Jaben > > Sent: Wednesday, March 28, 2018 7:43 AM > > To: edk2-devel@lists.01.org > > Cc: Gao, Liming ; Zhu, Yonghong > > > > Subject: [PATCH v1 1/4] BaseTools: remove irrelevant code > > > > Since PcdValue is a string, no need to test it's type() for string Also= remove > > the block used if it's a list (which is never is) > > > > Cc: Liming Gao > > Cc: Yonghong Zhu > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Jaben Carsey > > --- > > BaseTools/Source/Python/Common/Expression.py | 55 ++------------------ > > 1 file changed, 5 insertions(+), 50 deletions(-) > > > > diff --git a/BaseTools/Source/Python/Common/Expression.py > > b/BaseTools/Source/Python/Common/Expression.py > > index 4f0f377f3788..b70f7da1233e 100644 > > --- a/BaseTools/Source/Python/Common/Expression.py > > +++ b/BaseTools/Source/Python/Common/Expression.py > > @@ -815,57 +815,12 @@ class ValueExpressionEx(ValueExpression): > > except BadExpression, Value: > > if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64',= 'BOOLEAN']: > > PcdValue =3D PcdValue.strip() > > - if type(PcdValue) =3D=3D type('') and PcdValue.startsw= ith('{') and > > PcdValue.endswith('}'): > > + if PcdValue.startswith('{') and PcdValue.endswith('}')= : > > PcdValue =3D SplitPcdValueString(PcdValue[1:-1]) > > - if type(PcdValue) =3D=3D type([]): > > - TmpValue =3D 0 > > - Size =3D 0 > > - ValueType =3D '' > > - for Item in PcdValue: > > - Item =3D Item.strip() > > - if Item.startswith('UINT8'): > > - ItemSize =3D 1 > > - ValueType =3D 'UINT8' > > - elif Item.startswith('UINT16'): > > - ItemSize =3D 2 > > - ValueType =3D 'UINT16' > > - elif Item.startswith('UINT32'): > > - ItemSize =3D 4 > > - ValueType =3D 'UINT32' > > - elif Item.startswith('UINT64'): > > - ItemSize =3D 8 > > - ValueType =3D 'UINT64' > > - elif Item.startswith('"') or Item.startswith("= '") or > > Item.startswith('L'): > > - ItemSize =3D 0 > > - ValueType =3D 'VOID*' > > - else: > > - ItemSize =3D 0 > > - ValueType =3D 'UINT8' > > - Item =3D ValueExpressionEx(Item, ValueType, se= lf._Symb)(True) > > - > > - if ItemSize =3D=3D 0: > > - try: > > - tmpValue =3D int(Item, 16) if Item.upp= er().startswith('0X') > else > > int(Item, 0) > > - if tmpValue > 255: > > - raise BadExpression("Byte array n= umber %s should less > > than 0xFF." % Item) > > - except BadExpression, Value: > > - raise BadExpression(Value) > > - except ValueError: > > - pass > > - ItemValue, ItemSize =3D ParseFieldValue(It= em) > > - else: > > - ItemValue =3D ParseFieldValue(Item)[0] > > - > > - if type(ItemValue) =3D=3D type(''): > > - ItemValue =3D int(ItemValue, 16) if ItemVa= lue.startswith('0x') > > else int(ItemValue) > > - > > - TmpValue =3D (ItemValue << (Size * 8)) | TmpVa= lue > > - Size =3D Size + ItemSize > > - else: > > - try: > > - TmpValue, Size =3D ParseFieldValue(PcdValue) > > - except BadExpression, Value: > > - raise BadExpression("Type: %s, Value: %s, %s" = % > (self.PcdType, > > PcdValue, Value)) > > + try: > > + TmpValue, Size =3D ParseFieldValue(PcdValue) > > + except BadExpression, Value: > > + raise BadExpression("Type: %s, Value: %s, %s" % > > + (self.PcdType, PcdValue, Value)) > > if type(TmpValue) =3D=3D type(''): > > try: > > TmpValue =3D int(TmpValue) > > -- > > 2.16.2.windows.1