From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 31DF182226 for ; Wed, 22 Feb 2017 03:44:14 -0800 (PST) Received: by mail-io0-x22b.google.com with SMTP id l66so26535ioi.1 for ; Wed, 22 Feb 2017 03:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+T/rTTOC8JD7f0uHDy8h8i9dIU2LyjQi1DE5bdvQOTg=; b=QrzBSIk1EhbHWo/T+ly30vu1DV+r4euF+a04Pol3ZURvOSkS5w+aszVWZTWULPZUi7 fpI13H5SKoght3zQ2qEZksIDPSqnRFWq+AOl0M15oOozgnGcSQ41SzSb7HjIbpALEcdy qpUpwM7MizR0Mu7pNBjZS7L8zi5zm7cNNB+uk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+T/rTTOC8JD7f0uHDy8h8i9dIU2LyjQi1DE5bdvQOTg=; b=mhzKE6Jo80O/YHncCEgx1LNsYzNNWOpAzfg8PocRmx1j+5CLr2kgKB30E1+lRXbBFY J92fSOa3nnlIdAgnWyvuAyrvqBKkncXy6xwYYWRBTRTPU1x5/2qh6n7LTKKYHw5Hm97b YHhAZotlVLmVRyMKcHP/Lh6PHVbI+QpwiocUfPMudjXC2XoO8P2N6yN9HzFiWIzgwsXT zmrBdNWcnp/TtJ5LCVLYtcAmooAthkJQMdOV5gRuUWvIqKQNpN0Tj9IadM7Ii6xzJzgY QJ5wY8xVAlRWfhtaT1yPYkh3Tygmp5MtCHbvraSBL0DIOXRcF80WYCVHFZEqFzKDN/W/ nfmg== X-Gm-Message-State: AMke39nFJGZ0EXnJR68klBPydgV0R19abqiro3QqtMLEQLs51fd31C5ClXWFFNxArBB2ybLW/I2X4sDzVpf77sfT X-Received: by 10.107.13.130 with SMTP id 124mr14566562ion.83.1487763853447; Wed, 22 Feb 2017 03:44:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.198.134 with HTTP; Wed, 22 Feb 2017 03:44:13 -0800 (PST) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6E175C@shsmsx102.ccr.corp.intel.com> References: <1487639901-43004-1-git-send-email-yonghong.zhu@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14D6E175C@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Wed, 22 Feb 2017 11:44:13 +0000 Message-ID: To: "Gao, Liming" , Laszlo Ersek Cc: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Subject: Re: [Patch] BaseTools: add error check for Macro usage in the INF file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 11:44:14 -0000 Content-Type: text/plain; charset=UTF-8 On 21 February 2017 at 10:03, Gao, Liming wrote: > Reviewed-by: Liming Gao > This patch has broken ArmVirtQemu in the most mysterious way: it causes the constructor invocations in AutoGen.c to be emitted twice, e.g., ProcessLibraryConstructorList ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; Status = HobLibConstructor (ImageHandle, SystemTable); ASSERT_EFI_ERROR (Status); Status = HobLibConstructor (ImageHandle, SystemTable); ASSERT_EFI_ERROR (Status); Status = FdtPL011SerialPortLibInitialize (); ASSERT_EFI_ERROR (Status); Status = FdtPL011SerialPortLibInitialize (); ASSERT_EFI_ERROR (Status); Status = BaseDebugLibSerialPortConstructor (); ASSERT_EFI_ERROR (Status); Status = BaseDebugLibSerialPortConstructor (); ASSERT_EFI_ERROR (Status); which obviously breaks some assumptions, for instance, some HII registrations now hit an ASSERT() because of the duplicate GUID I have no idea how this happens, or what this patch does in the first place, so please investigate Thanks, Ard. > -----Original Message----- > From: Zhu, Yonghong > Sent: Tuesday, February 21, 2017 9:18 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [Patch] BaseTools: add error check for Macro usage in the INF file > > Use of MACRO statements in the EDK II INF files is limited to local > usage only; global or external macros are not permitted. This patch > add the check for not defined macros. > > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++++++++- > BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 4 +++- > 2 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index 1a5fdf5..37a7f5d 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -1,9 +1,9 @@ > ## @file > # This file is used to parse meta files > # > -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
> # (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
> # This program and the accompanying materials > # are licensed and made available under the terms and conditions of the BSD License > # which accompanies this distribution. The full text of the license may be found at > # http://opensource.org/licenses/bsd-license.php > @@ -349,10 +349,17 @@ class MetaFileParser(object): > EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", > ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > > self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] > Name, Value = self._ValueList[1], self._ValueList[2] > + MacroUsed = GlobalData.gMacroRefPattern.findall(Value) > + if len(MacroUsed) != 0: > + for Macro in MacroUsed: > + if Macro in GlobalData.gGlobalDefines: > + EdkLogger.error("Parser", FORMAT_INVALID, "Global macro %s is not permitted." % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > + else: > + EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined" % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > # Sometimes, we need to make differences between EDK and EDK2 modules > if Name == 'INF_VERSION': > if re.match(r'0[xX][\da-f-A-F]{5,8}', Value): > self._Version = int(Value, 0) > elif re.match(r'\d+\.\d+', Value): > diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > index e7bc87d..0686721 100644 > --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > @@ -1,9 +1,9 @@ > ## @file > # This file is used to create a database used by build tool > # > -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
> # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> # This program and the accompanying materials > # are licensed and made available under the terms and conditions of the BSD License > # which accompanies this distribution. The full text of the license may be found at > # http://opensource.org/licenses/bsd-license.php > @@ -1828,10 +1828,12 @@ class InfBuildData(ModuleBuildClassObject): > self.__Macros = {} > # EDK_GLOBAL defined macros can be applied to EDK module > if self.AutoGenVersion < 0x00010005: > self.__Macros.update(GlobalData.gEdkGlobal) > self.__Macros.update(GlobalData.gGlobalDefines) > + else: > + self.__Macros.update(self.Defines) > return self.__Macros > > ## Get architecture > def _GetArch(self): > return self._Arch > -- > 2.6.1.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel