[edk2] [Patch] BaseTools: Correct CCFLAG for PcdValueInit

Gao, Liming liming.gao at intel.com
Thu Dec 6 01:52:58 PST 2018


Reviewed-by: Liming Gao <liming.gao at intel.com>

> -----Original Message-----
> From: Feng, Bob C
> Sent: Wednesday, November 28, 2018 5:01 PM
> To: edk2-devel at lists.01.org
> Cc: Gao, Liming <liming.gao at 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 at intel.com>
> Cc: Liming Gao <liming.gao at 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



More information about the edk2-devel mailing list