* [Patch] BaseTools: Correct CCFLAG for PcdValueInit
@ 2018-11-28 9:01 BobCF
2018-12-06 9:52 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: BobCF @ 2018-11-28 9:01 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao
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>
---
.../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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools: Correct CCFLAG for PcdValueInit
2018-11-28 9:01 [Patch] BaseTools: Correct CCFLAG for PcdValueInit BobCF
@ 2018-12-06 9:52 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-12-06 9:52 UTC (permalink / raw)
To: Feng, Bob C, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Feng, Bob C
> Sent: Wednesday, November 28, 2018 5:01 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] 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>
> ---
> .../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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-06 9:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-28 9:01 [Patch] BaseTools: Correct CCFLAG for PcdValueInit BobCF
2018-12-06 9:52 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox