public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Remove EDK_GLOBAL related logic
@ 2019-03-16 14:34 Feng, Bob C
  2019-03-19  7:30 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, Bob C @ 2019-03-16 14:34 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bob Feng, Liming Gao

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350

Macros defined using EDK_GLOBAL are only valid when processing
EDK libraries and components.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/Common/DataType.py    |  1 -
 BaseTools/Source/Python/Common/GlobalData.py  |  3 +--
 .../Python/CommonDataClass/DataClass.py       |  1 -
 .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 19 ++----------------
 .../Source/Python/UPT/Library/Parsing.py      |  2 +-
 .../Source/Python/UPT/Logger/StringTable.py   |  2 --
 .../Source/Python/Workspace/InfBuildData.py   |  1 -
 .../Source/Python/Workspace/MetaFileParser.py | 20 ++-----------------
 8 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 798c0e353d..99bb60c852 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -415,11 +415,10 @@ TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
 TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
 TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
 TAB_DSC_DEFINES_DEFINE = 'DEFINE'
 TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
 TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
-TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
 TAB_DSC_PREBUILD = 'PREBUILD'
 TAB_DSC_POSTBUILD = 'POSTBUILD'
 #
 # TargetTxt Definitions
 #
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index f117998b0b..9f42484dc1 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -26,11 +26,10 @@ gPlatformDefines = {}
 gPlatformPcds = {}
 # PCDs with type that are not fixed at build and feature flag
 gPlatformOtherPcds = {}
 gActivePlatform = None
 gCommandLineDefines = {}
-gEdkGlobal = {}
 gOverrideDir = {}
 gCommandMaxLength = 4096
 # for debug trace purpose when problem occurs
 gProcessingFile = ''
 gBuildingModule = ''
@@ -40,11 +39,11 @@ gDefaultStores = []
 # definition for a MACRO name.  used to create regular expressions below.
 _MacroNamePattern = "[A-Z][A-Z0-9_]*"
 
 ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
 gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)
-gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
+gMacroDefPattern = re.compile("^(DEFINE)[ \t]+")
 gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
 
 # definition for a GUID.  used to create regular expressions below.
 _HexChar = r"[0-9a-fA-F]"
 _GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py b/BaseTools/Source/Python/CommonDataClass/DataClass.py
index 2d93f79b09..ec5bb194f4 100644
--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
@@ -105,11 +105,10 @@ MODEL_META_DATA_PACKAGE = 5011
 MODEL_META_DATA_NMAKE = 5012
 MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
 MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
 MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
 MODEL_META_DATA_COMMENT = 5016
-MODEL_META_DATA_GLOBAL_DEFINE = 5017
 MODEL_META_DATA_SECTION_HEADER = 5100
 MODEL_META_DATA_SUBSECTION_HEADER = 5200
 MODEL_META_DATA_TAIL_COMMENT = 5300
 
 MODEL_EXTERNAL_DEPENDENCY = 10000
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 862974894a..cba1f40837 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -40,11 +40,11 @@ from Common.LongFilePathSupport import CodecOpenLongFilePath
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
     def MacroParser(self):
         Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
         if not Match:
-            # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+            # Not 'DEFINE' statement, call decorated method
             Parser(self)
             return
 
         TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1)
         # Syntax check
@@ -81,20 +81,10 @@ def ParseMacro(Parser):
                 SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
                 if SectionDictKey not in self._SectionsMacroDict:
                     self._SectionsMacroDict[SectionDictKey] = {}
                 SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
                 SectionLocalMacros[Name] = Value
-        # EDK_GLOBAL defined macros
-        elif not isinstance(self, DscParser):
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        elif self._SectionType != MODEL_META_DATA_HEADER:
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
 
         self._ValueList = [Type, Name, Value]
 
     return MacroParser
 
@@ -740,11 +730,10 @@ class DscParser(MetaFileParser):
         TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper()        :   MODEL_PCD_DYNAMIC_EX_VPD,
         TAB_COMPONENTS.upper()                      :   MODEL_META_DATA_COMPONENT,
         TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() :   MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH,
         TAB_DSC_DEFINES.upper()                     :   MODEL_META_DATA_HEADER,
         TAB_DSC_DEFINES_DEFINE                      :   MODEL_META_DATA_DEFINE,
-        TAB_DSC_DEFINES_EDKGLOBAL                   :   MODEL_META_DATA_GLOBAL_DEFINE,
         TAB_INCLUDE.upper()                         :   MODEL_META_DATA_INCLUDE,
         TAB_IF.upper()                              :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
         TAB_IF_DEF.upper()                          :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
         TAB_IF_N_DEF.upper()                        :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
         TAB_ELSE_IF.upper()                         :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
@@ -1101,25 +1090,23 @@ class DscParser(MetaFileParser):
     ## Override parent's method since we'll do all macro replacements in parser
     def _GetMacros(self):
         Macros = dict( [('ARCH', 'IA32'), ('FAMILY', TAB_COMPILER_MSFT), ('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')])
         Macros.update(self._FileLocalMacros)
         Macros.update(self._GetApplicableSectionMacro())
-        Macros.update(GlobalData.gEdkGlobal)
         Macros.update(GlobalData.gPlatformDefines)
         Macros.update(GlobalData.gCommandLineDefines)
         # PCD cannot be referenced in macro definition
-        if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
+        if self._ItemType != MODEL_META_DATA_DEFINE:
             Macros.update(self._Symbols)
         return Macros
 
     def _PostProcess(self):
         Processer = {
             MODEL_META_DATA_SECTION_HEADER                  :   self.__ProcessSectionHeader,
             MODEL_META_DATA_SUBSECTION_HEADER               :   self.__ProcessSubsectionHeader,
             MODEL_META_DATA_HEADER                          :   self.__ProcessDefine,
             MODEL_META_DATA_DEFINE                          :   self.__ProcessDefine,
-            MODEL_META_DATA_GLOBAL_DEFINE                   :   self.__ProcessDefine,
             MODEL_META_DATA_INCLUDE                         :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IF        :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE      :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF     :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF    :   self.__ProcessDirective,
@@ -1274,12 +1261,10 @@ class DscParser(MetaFileParser):
                 SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
                 if SectionDictKey not in self._SectionsMacroDict:
                     self._SectionsMacroDict[SectionDictKey] = {}
                 SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
                 SectionLocalMacros[Name] = Value
-        elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
-            GlobalData.gEdkGlobal[Name] = Value
 
         #
         # Keyword in [Defines] section can be used as Macros
         #
         if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Source/Python/UPT/Library/Parsing.py
index f7e995b93e..683d10a2ed 100644
--- a/BaseTools/Source/Python/UPT/Library/Parsing.py
+++ b/BaseTools/Source/Python/UPT/Library/Parsing.py
@@ -895,11 +895,11 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
     LineContent = Line[0]
     LineNo = Line[1]
     Match = MacroDefPattern.match(LineContent)
     if not Match:
         #
-        # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+        # Not 'DEFINE' statement, call decorated method
         #
         return None, None
 
     TokenList = GetSplitValueList(LineContent[Match.end(1):], \
                                   DataType.TAB_EQUAL_SPLIT, 1)
diff --git a/BaseTools/Source/Python/UPT/Logger/StringTable.py b/BaseTools/Source/Python/UPT/Logger/StringTable.py
index d815d9cf89..4d47beee01 100644
--- a/BaseTools/Source/Python/UPT/Logger/StringTable.py
+++ b/BaseTools/Source/Python/UPT/Logger/StringTable.py
@@ -448,12 +448,10 @@ ERR_MACRONAME_NOGIVEN            = _("No MACRO name given")
 ERR_MACROVALUE_NOGIVEN           = _("No MACRO value given")
 ERR_MACRONAME_INVALID            = _("Incorrect MACRO name: %s")
 ERR_MACROVALUE_INVALID            = _("Incorrect MACRO value: %s")
 ERR_NAME_ONLY_DEFINE             = _(
     "This variable can only be defined via environment variable: %s")
-ERR_EDK_GLOBAL_SAMENAME          = _(
-    "EDK_GLOBAL defined a macro with the same name as one defined by 'DEFINE'")
 ERR_SECTIONNAME_INVALID          = _(
     "An incorrect section name was found: %s. 'The correct file is '%s' .")
 ERR_CHECKFILE_NOTFOUND           = _(
     "Can't find file '%s' defined in section '%s'")
 ERR_INVALID_NOTFOUND             = _(
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 6148ab0d30..985822ce4a 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -669,11 +669,10 @@ class InfBuildData(ModuleBuildClassObject):
         RetVal = []
         if self._SourceOverridePath:
             RetVal.append(self._SourceOverridePath)
 
         Macros = self._Macros
-        Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR', self._Arch)
         RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
         for Record in RecordList:
             File = NormPath(Record[0], Macros)
             if File[0] == '.':
                 File = os.path.join(self._ModuleDir, File)
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index e5fb3f5473..f6ebfe3b2e 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -46,11 +46,11 @@ CODEPattern = re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}")
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
     def MacroParser(self):
         Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
         if not Match:
-            # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+            # Not 'DEFINE' statement, call decorated method
             Parser(self)
             return
 
         TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1)
         # Syntax check
@@ -92,21 +92,10 @@ def ParseMacro(Parser):
                 elif self._SectionType == MODEL_META_DATA_HEADER:
                     self._FileLocalMacros[Name] = Value
                 else:
                     self._ConstructSectionMacroDict(Name, Value)
 
-        # EDK_GLOBAL defined macros
-        elif not isinstance(self, DscParser):
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
-        elif self._SectionType != MODEL_META_DATA_HEADER:
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
-        elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
-
         self._ValueList = [Type, Name, Value]
 
     return MacroParser
 
 ## Base class of parser
@@ -865,11 +854,10 @@ class DscParser(MetaFileParser):
         TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper()        :   MODEL_PCD_DYNAMIC_EX_VPD,
         TAB_COMPONENTS.upper()                      :   MODEL_META_DATA_COMPONENT,
         TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() :   MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH,
         TAB_DSC_DEFINES.upper()                     :   MODEL_META_DATA_HEADER,
         TAB_DSC_DEFINES_DEFINE                      :   MODEL_META_DATA_DEFINE,
-        TAB_DSC_DEFINES_EDKGLOBAL                   :   MODEL_META_DATA_GLOBAL_DEFINE,
         TAB_INCLUDE.upper()                         :   MODEL_META_DATA_INCLUDE,
         TAB_IF.upper()                              :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
         TAB_IF_DEF.upper()                          :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
         TAB_IF_N_DEF.upper()                        :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
         TAB_ELSE_IF.upper()                         :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
@@ -1323,15 +1311,14 @@ class DscParser(MetaFileParser):
     @property
     def _Macros(self):
         Macros = {}
         Macros.update(self._FileLocalMacros)
         Macros.update(self._GetApplicableSectionMacro())
-        Macros.update(GlobalData.gEdkGlobal)
         Macros.update(GlobalData.gPlatformDefines)
         Macros.update(GlobalData.gCommandLineDefines)
         # PCD cannot be referenced in macro definition
-        if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
+        if self._ItemType != MODEL_META_DATA_DEFINE:
             Macros.update(self._Symbols)
         if GlobalData.BuildOptionPcd:
             for Item in GlobalData.BuildOptionPcd:
                 if isinstance(Item, tuple):
                     continue
@@ -1344,11 +1331,10 @@ class DscParser(MetaFileParser):
         Processer = {
             MODEL_META_DATA_SECTION_HEADER                  :   self.__ProcessSectionHeader,
             MODEL_META_DATA_SUBSECTION_HEADER               :   self.__ProcessSubsectionHeader,
             MODEL_META_DATA_HEADER                          :   self.__ProcessDefine,
             MODEL_META_DATA_DEFINE                          :   self.__ProcessDefine,
-            MODEL_META_DATA_GLOBAL_DEFINE                   :   self.__ProcessDefine,
             MODEL_META_DATA_INCLUDE                         :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IF        :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE      :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF     :   self.__ProcessDirective,
             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF    :   self.__ProcessDirective,
@@ -1530,12 +1516,10 @@ class DscParser(MetaFileParser):
         if self._ItemType == MODEL_META_DATA_DEFINE:
             if self._SectionType == MODEL_META_DATA_HEADER:
                 self._FileLocalMacros[Name] = Value
             else:
                 self._ConstructSectionMacroDict(Name, Value)
-        elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
-            GlobalData.gEdkGlobal[Name] = Value
 
         #
         # Keyword in [Defines] section can be used as Macros
         #
         if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Remove EDK_GLOBAL related logic
  2019-03-16 14:34 [Patch] BaseTools: Remove EDK_GLOBAL related logic Feng, Bob C
@ 2019-03-19  7:30 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2019-03-19  7:30 UTC (permalink / raw)
  To: Feng, Bob C, edk2-devel@lists.01.org

Bob:
  Some platform still specifies EDK_GLOBAL, such as https://github.com/tianocore/edk2-platforms/blob/devel-MinPlatform/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc. Please update them first. 

Thanks
Liming
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Feng, Bob C
>Sent: Saturday, March 16, 2019 10:35 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [Patch] BaseTools: Remove EDK_GLOBAL related logic
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>
>Macros defined using EDK_GLOBAL are only valid when processing
>EDK libraries and components.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/Common/DataType.py    |  1 -
> BaseTools/Source/Python/Common/GlobalData.py  |  3 +--
> .../Python/CommonDataClass/DataClass.py       |  1 -
> .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 19 ++----------------
> .../Source/Python/UPT/Library/Parsing.py      |  2 +-
> .../Source/Python/UPT/Logger/StringTable.py   |  2 --
> .../Source/Python/Workspace/InfBuildData.py   |  1 -
> .../Source/Python/Workspace/MetaFileParser.py | 20 ++-----------------
> 8 files changed, 6 insertions(+), 43 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Common/DataType.py
>b/BaseTools/Source/Python/Common/DataType.py
>index 798c0e353d..99bb60c852 100644
>--- a/BaseTools/Source/Python/Common/DataType.py
>+++ b/BaseTools/Source/Python/Common/DataType.py
>@@ -415,11 +415,10 @@ TAB_DSC_DEFINES_RT_BASE_ADDRESS =
>'RtBaseAddress'
> TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
> TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
> TAB_DSC_DEFINES_DEFINE = 'DEFINE'
> TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
> TAB_FIX_LOAD_TOP_MEMORY_ADDRESS =
>'FIX_LOAD_TOP_MEMORY_ADDRESS'
>-TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
> TAB_DSC_PREBUILD = 'PREBUILD'
> TAB_DSC_POSTBUILD = 'POSTBUILD'
> #
> # TargetTxt Definitions
> #
>diff --git a/BaseTools/Source/Python/Common/GlobalData.py
>b/BaseTools/Source/Python/Common/GlobalData.py
>index f117998b0b..9f42484dc1 100644
>--- a/BaseTools/Source/Python/Common/GlobalData.py
>+++ b/BaseTools/Source/Python/Common/GlobalData.py
>@@ -26,11 +26,10 @@ gPlatformDefines = {}
> gPlatformPcds = {}
> # PCDs with type that are not fixed at build and feature flag
> gPlatformOtherPcds = {}
> gActivePlatform = None
> gCommandLineDefines = {}
>-gEdkGlobal = {}
> gOverrideDir = {}
> gCommandMaxLength = 4096
> # for debug trace purpose when problem occurs
> gProcessingFile = ''
> gBuildingModule = ''
>@@ -40,11 +39,11 @@ gDefaultStores = []
> # definition for a MACRO name.  used to create regular expressions below.
> _MacroNamePattern = "[A-Z][A-Z0-9_]*"
>
> ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
> gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern),
>re.UNICODE)
>-gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
>+gMacroDefPattern = re.compile("^(DEFINE)[ \t]+")
> gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
>
> # definition for a GUID.  used to create regular expressions below.
> _HexChar = r"[0-9a-fA-F]"
> _GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-
>{Hex}{{12}}".format(Hex=_HexChar)
>diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py
>b/BaseTools/Source/Python/CommonDataClass/DataClass.py
>index 2d93f79b09..ec5bb194f4 100644
>--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
>+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
>@@ -105,11 +105,10 @@ MODEL_META_DATA_PACKAGE = 5011
> MODEL_META_DATA_NMAKE = 5012
> MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
> MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
> MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
> MODEL_META_DATA_COMMENT = 5016
>-MODEL_META_DATA_GLOBAL_DEFINE = 5017
> MODEL_META_DATA_SECTION_HEADER = 5100
> MODEL_META_DATA_SUBSECTION_HEADER = 5200
> MODEL_META_DATA_TAIL_COMMENT = 5300
>
> MODEL_EXTERNAL_DEPENDENCY = 10000
>diff --git
>a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>index 862974894a..cba1f40837 100644
>--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>@@ -40,11 +40,11 @@ from Common.LongFilePathSupport import
>CodecOpenLongFilePath
> ## A decorator used to parse macro definition
> def ParseMacro(Parser):
>     def MacroParser(self):
>         Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
>         if not Match:
>-            # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
>+            # Not 'DEFINE' statement, call decorated method
>             Parser(self)
>             return
>
>         TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):],
>TAB_EQUAL_SPLIT, 1)
>         # Syntax check
>@@ -81,20 +81,10 @@ def ParseMacro(Parser):
>                 SectionDictKey = self._SectionType, self._Scope[0][0],
>self._Scope[0][1]
>                 if SectionDictKey not in self._SectionsMacroDict:
>                     self._SectionsMacroDict[SectionDictKey] = {}
>                 SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
>                 SectionLocalMacros[Name] = Value
>-        # EDK_GLOBAL defined macros
>-        elif not isinstance(self, DscParser):
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be
>used in .dsc file",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex+1)
>-        elif self._SectionType != MODEL_META_DATA_HEADER:
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be
>used under [Defines] section",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex+1)
>-        elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] !=
>Value):
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a
>macro with the same name and different value as one defined by 'DEFINE'",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex+1)
>
>         self._ValueList = [Type, Name, Value]
>
>     return MacroParser
>
>@@ -740,11 +730,10 @@ class DscParser(MetaFileParser):
>         TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper()        :
>MODEL_PCD_DYNAMIC_EX_VPD,
>         TAB_COMPONENTS.upper()                      :
>MODEL_META_DATA_COMPONENT,
>         TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() :
>MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH,
>         TAB_DSC_DEFINES.upper()                     :   MODEL_META_DATA_HEADER,
>         TAB_DSC_DEFINES_DEFINE                      :   MODEL_META_DATA_DEFINE,
>-        TAB_DSC_DEFINES_EDKGLOBAL                   :
>MODEL_META_DATA_GLOBAL_DEFINE,
>         TAB_INCLUDE.upper()                         :   MODEL_META_DATA_INCLUDE,
>         TAB_IF.upper()                              :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
>         TAB_IF_DEF.upper()                          :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
>         TAB_IF_N_DEF.upper()                        :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
>         TAB_ELSE_IF.upper()                         :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
>@@ -1101,25 +1090,23 @@ class DscParser(MetaFileParser):
>     ## Override parent's method since we'll do all macro replacements in
>parser
>     def _GetMacros(self):
>         Macros = dict( [('ARCH', 'IA32'), ('FAMILY', TAB_COMPILER_MSFT),
>('TOOL_CHAIN_TAG', 'VS2008x86'), ('TARGET', 'DEBUG')])
>         Macros.update(self._FileLocalMacros)
>         Macros.update(self._GetApplicableSectionMacro())
>-        Macros.update(GlobalData.gEdkGlobal)
>         Macros.update(GlobalData.gPlatformDefines)
>         Macros.update(GlobalData.gCommandLineDefines)
>         # PCD cannot be referenced in macro definition
>-        if self._ItemType not in [MODEL_META_DATA_DEFINE,
>MODEL_META_DATA_GLOBAL_DEFINE]:
>+        if self._ItemType != MODEL_META_DATA_DEFINE:
>             Macros.update(self._Symbols)
>         return Macros
>
>     def _PostProcess(self):
>         Processer = {
>             MODEL_META_DATA_SECTION_HEADER                  :
>self.__ProcessSectionHeader,
>             MODEL_META_DATA_SUBSECTION_HEADER               :
>self.__ProcessSubsectionHeader,
>             MODEL_META_DATA_HEADER                          :   self.__ProcessDefine,
>             MODEL_META_DATA_DEFINE                          :   self.__ProcessDefine,
>-            MODEL_META_DATA_GLOBAL_DEFINE                   :
>self.__ProcessDefine,
>             MODEL_META_DATA_INCLUDE                         :   self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IF        :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE      :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF     :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF    :
>self.__ProcessDirective,
>@@ -1274,12 +1261,10 @@ class DscParser(MetaFileParser):
>                 SectionDictKey = self._SectionType, self._Scope[0][0],
>self._Scope[0][1]
>                 if SectionDictKey not in self._SectionsMacroDict:
>                     self._SectionsMacroDict[SectionDictKey] = {}
>                 SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
>                 SectionLocalMacros[Name] = Value
>-        elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
>-            GlobalData.gEdkGlobal[Name] = Value
>
>         #
>         # Keyword in [Defines] section can be used as Macros
>         #
>         if (self._ItemType == MODEL_META_DATA_HEADER) and
>(self._SectionType == MODEL_META_DATA_HEADER):
>diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py
>b/BaseTools/Source/Python/UPT/Library/Parsing.py
>index f7e995b93e..683d10a2ed 100644
>--- a/BaseTools/Source/Python/UPT/Library/Parsing.py
>+++ b/BaseTools/Source/Python/UPT/Library/Parsing.py
>@@ -895,11 +895,11 @@ def MacroParser(Line, FileName, SectionType,
>FileLocalMacros):
>     LineContent = Line[0]
>     LineNo = Line[1]
>     Match = MacroDefPattern.match(LineContent)
>     if not Match:
>         #
>-        # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
>+        # Not 'DEFINE' statement, call decorated method
>         #
>         return None, None
>
>     TokenList = GetSplitValueList(LineContent[Match.end(1):], \
>                                   DataType.TAB_EQUAL_SPLIT, 1)
>diff --git a/BaseTools/Source/Python/UPT/Logger/StringTable.py
>b/BaseTools/Source/Python/UPT/Logger/StringTable.py
>index d815d9cf89..4d47beee01 100644
>--- a/BaseTools/Source/Python/UPT/Logger/StringTable.py
>+++ b/BaseTools/Source/Python/UPT/Logger/StringTable.py
>@@ -448,12 +448,10 @@ ERR_MACRONAME_NOGIVEN            = _("No MACRO
>name given")
> ERR_MACROVALUE_NOGIVEN           = _("No MACRO value given")
> ERR_MACRONAME_INVALID            = _("Incorrect MACRO name: %s")
> ERR_MACROVALUE_INVALID            = _("Incorrect MACRO value: %s")
> ERR_NAME_ONLY_DEFINE             = _(
>     "This variable can only be defined via environment variable: %s")
>-ERR_EDK_GLOBAL_SAMENAME          = _(
>-    "EDK_GLOBAL defined a macro with the same name as one defined by
>'DEFINE'")
> ERR_SECTIONNAME_INVALID          = _(
>     "An incorrect section name was found: %s. 'The correct file is '%s' .")
> ERR_CHECKFILE_NOTFOUND           = _(
>     "Can't find file '%s' defined in section '%s'")
> ERR_INVALID_NOTFOUND             = _(
>diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
>b/BaseTools/Source/Python/Workspace/InfBuildData.py
>index 6148ab0d30..985822ce4a 100644
>--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
>@@ -669,11 +669,10 @@ class InfBuildData(ModuleBuildClassObject):
>         RetVal = []
>         if self._SourceOverridePath:
>             RetVal.append(self._SourceOverridePath)
>
>         Macros = self._Macros
>-        Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR',
>self._Arch)
>         RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch,
>self._Platform]
>         for Record in RecordList:
>             File = NormPath(Record[0], Macros)
>             if File[0] == '.':
>                 File = os.path.join(self._ModuleDir, File)
>diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py
>b/BaseTools/Source/Python/Workspace/MetaFileParser.py
>index e5fb3f5473..f6ebfe3b2e 100644
>--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
>+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
>@@ -46,11 +46,11 @@ CODEPattern = re.compile(r"{CODE\([a-fA-F0-
>9Xx\{\},\s]*\)}")
> ## A decorator used to parse macro definition
> def ParseMacro(Parser):
>     def MacroParser(self):
>         Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
>         if not Match:
>-            # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
>+            # Not 'DEFINE' statement, call decorated method
>             Parser(self)
>             return
>
>         TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):],
>TAB_EQUAL_SPLIT, 1)
>         # Syntax check
>@@ -92,21 +92,10 @@ def ParseMacro(Parser):
>                 elif self._SectionType == MODEL_META_DATA_HEADER:
>                     self._FileLocalMacros[Name] = Value
>                 else:
>                     self._ConstructSectionMacroDict(Name, Value)
>
>-        # EDK_GLOBAL defined macros
>-        elif not isinstance(self, DscParser):
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be
>used in .dsc file",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex + 1)
>-        elif self._SectionType != MODEL_META_DATA_HEADER:
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be
>used under [Defines] section",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex + 1)
>-        elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] !=
>Value):
>-            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a
>macro with the same name and different value as one defined by 'DEFINE'",
>-                            ExtraData=self._CurrentLine, File=self.MetaFile,
>Line=self._LineIndex + 1)
>-
>         self._ValueList = [Type, Name, Value]
>
>     return MacroParser
>
> ## Base class of parser
>@@ -865,11 +854,10 @@ class DscParser(MetaFileParser):
>         TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper()        :
>MODEL_PCD_DYNAMIC_EX_VPD,
>         TAB_COMPONENTS.upper()                      :
>MODEL_META_DATA_COMPONENT,
>         TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() :
>MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH,
>         TAB_DSC_DEFINES.upper()                     :   MODEL_META_DATA_HEADER,
>         TAB_DSC_DEFINES_DEFINE                      :   MODEL_META_DATA_DEFINE,
>-        TAB_DSC_DEFINES_EDKGLOBAL                   :
>MODEL_META_DATA_GLOBAL_DEFINE,
>         TAB_INCLUDE.upper()                         :   MODEL_META_DATA_INCLUDE,
>         TAB_IF.upper()                              :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
>         TAB_IF_DEF.upper()                          :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
>         TAB_IF_N_DEF.upper()                        :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF,
>         TAB_ELSE_IF.upper()                         :
>MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
>@@ -1323,15 +1311,14 @@ class DscParser(MetaFileParser):
>     @property
>     def _Macros(self):
>         Macros = {}
>         Macros.update(self._FileLocalMacros)
>         Macros.update(self._GetApplicableSectionMacro())
>-        Macros.update(GlobalData.gEdkGlobal)
>         Macros.update(GlobalData.gPlatformDefines)
>         Macros.update(GlobalData.gCommandLineDefines)
>         # PCD cannot be referenced in macro definition
>-        if self._ItemType not in [MODEL_META_DATA_DEFINE,
>MODEL_META_DATA_GLOBAL_DEFINE]:
>+        if self._ItemType != MODEL_META_DATA_DEFINE:
>             Macros.update(self._Symbols)
>         if GlobalData.BuildOptionPcd:
>             for Item in GlobalData.BuildOptionPcd:
>                 if isinstance(Item, tuple):
>                     continue
>@@ -1344,11 +1331,10 @@ class DscParser(MetaFileParser):
>         Processer = {
>             MODEL_META_DATA_SECTION_HEADER                  :
>self.__ProcessSectionHeader,
>             MODEL_META_DATA_SUBSECTION_HEADER               :
>self.__ProcessSubsectionHeader,
>             MODEL_META_DATA_HEADER                          :   self.__ProcessDefine,
>             MODEL_META_DATA_DEFINE                          :   self.__ProcessDefine,
>-            MODEL_META_DATA_GLOBAL_DEFINE                   :
>self.__ProcessDefine,
>             MODEL_META_DATA_INCLUDE                         :   self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IF        :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE      :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF     :
>self.__ProcessDirective,
>             MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF    :
>self.__ProcessDirective,
>@@ -1530,12 +1516,10 @@ class DscParser(MetaFileParser):
>         if self._ItemType == MODEL_META_DATA_DEFINE:
>             if self._SectionType == MODEL_META_DATA_HEADER:
>                 self._FileLocalMacros[Name] = Value
>             else:
>                 self._ConstructSectionMacroDict(Name, Value)
>-        elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
>-            GlobalData.gEdkGlobal[Name] = Value
>
>         #
>         # Keyword in [Defines] section can be used as Macros
>         #
>         if (self._ItemType == MODEL_META_DATA_HEADER) and
>(self._SectionType == MODEL_META_DATA_HEADER):
>--
>2.18.0.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-19  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-16 14:34 [Patch] BaseTools: Remove EDK_GLOBAL related logic Feng, Bob C
2019-03-19  7:30 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox