From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 C8A9E21A02937 for ; Wed, 28 Nov 2018 01:01:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2018 01:01:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,290,1539673200"; d="scan'208";a="112876135" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga001.jf.intel.com with ESMTP; 28 Nov 2018 01:01:21 -0800 From: BobCF To: edk2-devel@lists.01.org Cc: Liming Gao Date: Wed, 28 Nov 2018 17:01:18 +0800 Message-Id: <20181128090118.74272-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 MIME-Version: 1.0 Subject: [Patch] BaseTools: Correct CCFLAG for PcdValueInit X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2018 09:01:24 -0000 Content-Transfer-Encoding: 8bit https://bugzilla.tianocore.org/show_bug.cgi?id=1361 This patch is going to correct the CCFlag for building PcdValueInit Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: BobCF Cc: Liming Gao --- .../Source/Python/Workspace/DscBuildData.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 11aa63fb26..c04f970c7d 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2184,20 +2184,20 @@ class DscBuildData(PlatformBuildClassObject): return False return True def ParseCCFlags(self, ccflag): ccflags = set() - flag = "" - for ch in ccflag: - if ch in (r"/", "-"): - if flag.strip(): - ccflags.add(flag.strip()) - flag = ch - else: - flag += ch - if flag.strip(): - ccflags.add(flag.strip()) + ccflaglist = ccflag.split(" ") + i = 0 + while i < len(ccflaglist): + item = ccflaglist[i].strip() + if item in (r"/D", r"/U","-D","-U"): + ccflags.add(" ".join((ccflaglist[i],ccflaglist[i+1]))) + i = i+1 + elif item.startswith((r"/D", r"/U","-D","-U")): + ccflags.add(item) + i +=1 return ccflags def GenerateByteArrayValue (self, StructuredPcds): # # Generate/Compile/Run C application to determine if there are any flexible array members # @@ -2318,11 +2318,11 @@ class DscBuildData(PlatformBuildClassObject): if Target == "*" or Target == self._Target: if Tag == "*" or Tag == self._Toolchain: if 'COMMON' not in BuildOptions: BuildOptions['COMMON'] = set() if Arch == "*": - BuildOptions['COMMON'].add(self.BuildOptions[Options]) + BuildOptions['COMMON']|= self.ParseCCFlags(self.BuildOptions[Options]) if Arch in self.SupArchList: if Arch not in BuildOptions: BuildOptions[Arch] = set() BuildOptions[Arch] |= self.ParseCCFlags(self.BuildOptions[Options]) @@ -2332,11 +2332,11 @@ class DscBuildData(PlatformBuildClassObject): BuildOptions['COMMON'] |= (ArchBuildOptions.values()[0]) elif len(ArchBuildOptions.keys()) > 1: CommonBuildOptions = reduce(lambda x,y: x&y, ArchBuildOptions.values()) BuildOptions['COMMON'] |= CommonBuildOptions ValueList = list(BuildOptions['COMMON']) - CC_FLAGS += " ".join([item for item in ValueList if item.startswith(('-D', '/D', '-U', '/U'))]) + CC_FLAGS += " ".join(ValueList) MakeApp += CC_FLAGS if sys.platform == "win32": MakeApp = MakeApp + PcdMakefileEnd MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) $(APPFILE) /y """) -- 2.19.1.windows.1