public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: BobCF <bob.c.feng@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Correct CCFLAG for PcdValueInit
Date: Wed, 28 Nov 2018 17:01:18 +0800	[thread overview]
Message-ID: <20181128090118.74272-1-bob.c.feng@intel.com> (raw)

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



             reply	other threads:[~2018-11-28  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  9:01 BobCF [this message]
2018-12-06  9:52 ` [Patch] BaseTools: Correct CCFLAG for PcdValueInit Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181128090118.74272-1-bob.c.feng@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox