BaseTools: Correct CCFLAG for PcdValueInit

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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
BobCF 2018-12-07 10:39:52 +08:00
parent bf9e636605
commit 9601046bf4
1 changed files with 12 additions and 12 deletions

View File

@ -2352,16 +2352,16 @@ class DscBuildData(PlatformBuildClassObject):
def ParseCCFlags(self, ccflag): def ParseCCFlags(self, ccflag):
ccflags = set() ccflags = set()
flag = "" ccflaglist = ccflag.split(" ")
for ch in ccflag: i = 0
if ch in (r"/", "-"): while i < len(ccflaglist):
if flag.strip(): item = ccflaglist[i].strip()
ccflags.add(flag.strip()) if item in (r"/D", r"/U","-D","-U"):
flag = ch ccflags.add(" ".join((ccflaglist[i],ccflaglist[i+1])))
else: i = i+1
flag += ch elif item.startswith((r"/D", r"/U","-D","-U")):
if flag.strip(): ccflags.add(item)
ccflags.add(flag.strip()) i +=1
return ccflags return ccflags
def GenerateByteArrayValue (self, StructuredPcds): def GenerateByteArrayValue (self, StructuredPcds):
# #
@ -2488,7 +2488,7 @@ class DscBuildData(PlatformBuildClassObject):
if 'COMMON' not in BuildOptions: if 'COMMON' not in BuildOptions:
BuildOptions['COMMON'] = set() BuildOptions['COMMON'] = set()
if Arch == TAB_STAR: if Arch == TAB_STAR:
BuildOptions['COMMON'].add(self.BuildOptions[Options]) BuildOptions['COMMON']|= self.ParseCCFlags(self.BuildOptions[Options])
if Arch in self.SupArchList: if Arch in self.SupArchList:
if Arch not in BuildOptions: if Arch not in BuildOptions:
BuildOptions[Arch] = set() BuildOptions[Arch] = set()
@ -2502,7 +2502,7 @@ class DscBuildData(PlatformBuildClassObject):
CommonBuildOptions = reduce(lambda x,y: x&y, ArchBuildOptions.values()) CommonBuildOptions = reduce(lambda x,y: x&y, ArchBuildOptions.values())
BuildOptions['COMMON'] |= CommonBuildOptions BuildOptions['COMMON'] |= CommonBuildOptions
ValueList = list(BuildOptions['COMMON']) 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 MakeApp += CC_FLAGS
if sys.platform == "win32": if sys.platform == "win32":