summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2025-04-30 14:29:25 +0200
committerLiming Gao <gaoliming@byosoft.com.cn>2025-07-01 09:51:38 +0800
commitf79717aac2345568f46d69e125972342850ebd1e (patch)
tree0e9fe151cfb00b743ce1b0c6ac5167a61d821a26 /BaseTools/Source/Python
parentc169a5420b25f6e95e1ca8223051aade870f0d03 (diff)
downloadedk2-f79717aac2345568f46d69e125972342850ebd1e.zip
edk2-f79717aac2345568f46d69e125972342850ebd1e.tar.gz
edk2-f79717aac2345568f46d69e125972342850ebd1e.tar.bz2
BaseTools: AutoGen: Remove unnecessary code
Running the vulture tool on the AutoGen folder gave the following report. Remove the unnecessary code. - AutoGen/BuildEngine.py:333: unused attribute 'SupportedToolChainFamilyList' (60% confidence) - AutoGen/BuildEngine.py:346: unused attribute '_RuleObjectList' (60% confidence) - AutoGen/GenMake.py:450: unused attribute 'FileBuildTargetList' (60% confidence) - AutoGen/GenMake.py:452: unused attribute 'PendingBuildTargetList' (60% confidence) - AutoGen/GenMake.py:458: unused attribute 'LibraryBuildCommandList' (60% confidence) - AutoGen/GenMake.py:459: unused attribute 'LibraryFileList' (60% confidence) - AutoGen/GenMake.py:462: unused attribute 'SystemLibraryList' (60% confidence) - AutoGen/GenMake.py:1168: unused method 'GetFileDependency' (60% confidence) - AutoGen/GenMake.py:1466: unused attribute 'ModuleBuildCommandList' (60% confidence) - AutoGen/GenPcdDb.py:442: unused class 'DbSkuHeadTableItemList' (60% confidence) - AutoGen/GenVar.py:31: unused attribute 'VpdRegionOffset' (60% confidence) - AutoGen/GenVar.py:43: unused attribute 'VpdRegionOffset' (60% confidence) - AutoGen/ModuleAutoGen.py:257: unused attribute 'FileDependCache' (60% confidence) - AutoGen/ModuleAutoGen.py:684: unused method 'BuildOptionIncPathList' (60% confidence) - AutoGen/PlatformAutoGen.py:994: unused method 'EdkBuildOption' (60% confidence) - AutoGen/UniClassObject.py:171: unused attribute 'StringNameByteList' (60% confidence) - AutoGen/UniClassObject.py:181: unused attribute 'StringNameByteList' (60% confidence) - AutoGen/UniClassObject.py:366: unused method 'GetIncludeFile' (60% confidence) - AutoGen/UniClassObject.py:606: unused method 'FindStringValue' (60% confidence) - AutoGen/UniClassObject.py:616: unused method 'FindByToken' (60% confidence) - AutoGen/ValidCheckingInfoObject.py:228: unused attribute 'ValidData' (60% confidence) - AutoGen/ValidCheckingInfoObject.py:231: unused attribute 'ValidData' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/AutoGen/BuildEngine.py2
-rwxr-xr-xBaseTools/Source/Python/AutoGen/GenMake.py21
-rw-r--r--BaseTools/Source/Python/AutoGen/GenPcdDb.py17
-rw-r--r--BaseTools/Source/Python/AutoGen/GenVar.py4
-rwxr-xr-xBaseTools/Source/Python/AutoGen/ModuleAutoGen.py45
-rw-r--r--BaseTools/Source/Python/AutoGen/PlatformAutoGen.py6
-rw-r--r--BaseTools/Source/Python/AutoGen/UniClassObject.py29
-rw-r--r--BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py2
8 files changed, 0 insertions, 126 deletions
diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 45b39d7..b829a25 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -330,7 +330,6 @@ class BuildRule:
else:
EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given")
- self.SupportedToolChainFamilyList = SupportedFamily
self.RuleDatabase = tdict(True, 4) # {FileExt, ModuleType, Arch, Family : FileBuildRule object}
self.Ext2FileType = {} # {ext : file-type}
self.FileTypeList = set()
@@ -343,7 +342,6 @@ class BuildRule:
self._ArchList = set()
self._FamilyList = []
self._TotalToolChainFamilySet = set()
- self._RuleObjectList = [] # FileBuildRule object list
self._FileVersion = ""
self.Parse()
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 547c708..e5f282c 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -447,19 +447,14 @@ cleanlib:
self.ResultFileList = []
self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
- self.FileBuildTargetList = [] # [(src, target string)]
self.BuildTargetList = [] # [target string]
- self.PendingBuildTargetList = [] # [FileBuildRule objects]
self.CommonFileDependency = []
self.FileListMacros = {}
self.ListFileMacros = {}
self.ObjTargetDict = OrderedDict()
self.FileCache = {}
- self.LibraryBuildCommandList = []
- self.LibraryFileList = []
self.LibraryMakefileList = []
self.LibraryBuildDirectoryList = []
- self.SystemLibraryList = []
self.Macros = OrderedDict()
self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"]
self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"]
@@ -1157,21 +1152,6 @@ cleanlib:
if not LibraryAutoGen.IsBinaryModule:
self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros))
- ## Return a list containing source file's dependencies
- #
- # @param FileList The list of source files
- # @param ForceInculeList The list of files which will be included forcely
- # @param SearchPathList The list of search path
- #
- # @retval dict The mapping between source file path and its dependencies
- #
- def GetFileDependency(self, FileList, ForceInculeList, SearchPathList):
- Dependency = {}
- for F in FileList:
- Dependency[F] = GetDependencyList(self._AutoGenObject, self.FileCache, F, ForceInculeList, SearchPathList)
- return Dependency
-
-
## CustomMakefile class
#
# This class encapsules makefie and its generation for module. It uses template to generate
@@ -1463,7 +1443,6 @@ cleanlib:
#
def __init__(self, PlatformAutoGen):
BuildFile.__init__(self, PlatformAutoGen)
- self.ModuleBuildCommandList = []
self.ModuleMakefileList = []
self.IntermediateDirectoryList = []
self.ModuleBuildDirectoryList = []
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index ad5dae0..28df647 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -435,23 +435,6 @@ class DbStringHeadTableItemList(DbItemList):
self.ListSize += self.ItemSize
return self.ListSize
-## DbSkuHeadTableItemList
-#
-# The class holds the Sku header value table
-#
-class DbSkuHeadTableItemList (DbItemList):
- def __init__(self, ItemSize, DataList=None, RawDataList=None):
- DbItemList.__init__(self, ItemSize, DataList, RawDataList)
-
- def PackData(self):
- PackStr = "=LL"
- Buffer = bytearray()
- for Data in self.RawDataList:
- Buffer += pack(PackStr,
- GetIntegerValue(Data[0]),
- GetIntegerValue(Data[1]))
- return Buffer
-
## DbSizeTableItemList
#
# The class holds the size table
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index f2ad54b..54d7864 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -28,7 +28,6 @@ class VariableMgr(object):
self.DefaultStoreMap = DefaultStoreMap
self.SkuIdMap = SkuIdMap
self.VpdRegionSize = 0
- self.VpdRegionOffset = 0
self.NVHeaderBuff = None
self.VarDefaultBuff = None
self.VarDeltaBuff = None
@@ -39,9 +38,6 @@ class VariableMgr(object):
def SetVpdRegionMaxSize(self, maxsize):
self.VpdRegionSize = maxsize
- def SetVpdRegionOffset(self, vpdoffset):
- self.VpdRegionOffset = vpdoffset
-
def PatchNVStoreDefaultMaxSize(self, maxsize):
if not self.NVHeaderBuff:
return ""
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index 65a2176..aa0b716 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -254,7 +254,6 @@ class ModuleAutoGen(AutoGen):
self.AutoGenDepSet = set()
self.ReferenceModules = []
self.ConstPcd = {}
- self.FileDependCache = {}
def __init_platform_info__(self):
pinfo = self.DataPipe.Get("P_Info")
@@ -677,50 +676,6 @@ class ModuleAutoGen(AutoGen):
self.BuildRuleOrder = ['.%s' % Ext for Ext in self.BuildRuleOrder.split()]
return RetVal
- ## Get include path list from tool option for the module build
- #
- # @retval list The include path list
- #
- @cached_property
- def BuildOptionIncPathList(self):
- #
- # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC
- # is the former use /I , the Latter used -I to specify include directories
- #
- if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
- BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
- elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC'):
- BuildOptIncludeRegEx = gBuildOptIncludePatternOther
- else:
- #
- # New ToolChainFamily, don't known whether there is option to specify include directories
- #
- return []
-
- RetVal = []
- for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
- try:
- FlagOption = self.BuildOption[Tool]['FLAGS']
- except KeyError:
- FlagOption = ''
-
- IncPathList = [NormPath(Path, self.Macros) for Path in BuildOptIncludeRegEx.findall(FlagOption)]
-
- #
- # EDK II modules must not reference header files outside of the packages they depend on or
- # within the module's directory tree. Report error if violation.
- #
- if GlobalData.gDisableIncludePathCheck == False:
- for Path in IncPathList:
- if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
- ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
- EdkLogger.error("build",
- PARAMETER_INVALID,
- ExtraData=ErrMsg,
- File=str(self.MetaFile))
- RetVal += IncPathList
- return RetVal
-
## Return a list of files which can be built from source
#
# What kind of files can be built is determined by build rules in
diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index e80203d..68b9d89 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -251,7 +251,6 @@ class PlatformAutoGen(AutoGen):
VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), self.DscBuildDataObj.SkuIds)
VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
- VariableInfo.SetVpdRegionOffset(VpdRegionBase)
Index = 0
for Pcd in sorted(DynamicPcdSet):
pcdname = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
@@ -990,11 +989,6 @@ class PlatformAutoGen(AutoGen):
def _BuildOptionWithToolDef(self, ToolDef):
return self._ExpandBuildOption(self.Platform.BuildOptions, ToolDef=ToolDef)
- ## Return the build options specific for EDK modules in this platform
- @cached_property
- def EdkBuildOption(self):
- return self._ExpandBuildOption(self.Platform.BuildOptions, EDK_NAME)
-
## Return the build options specific for EDKII modules in this platform
@cached_property
def EdkIIBuildOption(self):
diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py
index b16330e..6d62fa0 100644
--- a/BaseTools/Source/Python/AutoGen/UniClassObject.py
+++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py
@@ -168,7 +168,6 @@ codecs.register(Ucs2Search)
class StringDefClassObject(object):
def __init__(self, Name = None, Value = None, Referenced = False, Token = None, UseOtherLangDef = ''):
self.StringName = ''
- self.StringNameByteList = []
self.StringValue = ''
self.StringValueByteList = ''
self.Token = 0
@@ -178,7 +177,6 @@ class StringDefClassObject(object):
if Name is not None:
self.StringName = Name
- self.StringNameByteList = UniToHexList(Name)
if Value is not None:
self.StringValue = Value + u'\x00' # Add a NULL at string tail
self.StringValueByteList = UniToHexList(self.StringValue)
@@ -361,13 +359,6 @@ class UniFileClassObject(object):
self.AddStringToList(Name, Language, Value)
#
- # Get include file list and load them
- #
- def GetIncludeFile(self, Item, Dir):
- FileName = Item[Item.find(u'#include ') + len(u'#include ') :Item.find(u' ', len(u'#include '))][1:-1]
- self.LoadUniFile(FileName)
-
- #
# Pre-process before parse .uni file
#
def PreProcess(self, File):
@@ -601,26 +592,6 @@ class UniFileClassObject(object):
Item.Referenced = True
#
- # Search the string in language definition by Name
- #
- def FindStringValue(self, Name, Lang):
- if Name in self.OrderedStringDict[Lang]:
- ItemIndexInList = self.OrderedStringDict[Lang][Name]
- return self.OrderedStringList[Lang][ItemIndexInList]
-
- return None
-
- #
- # Search the string in language definition by Token
- #
- def FindByToken(self, Token, Lang):
- for Item in self.OrderedStringList[Lang]:
- if Item.Token == Token:
- return Item
-
- return None
-
- #
# Re-order strings and re-generate tokens
#
def ReToken(self):
diff --git a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
index ad8c9b5..d4fc31a 100644
--- a/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
+++ b/BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
@@ -225,10 +225,8 @@ class VAR_CHECK_PCD_VALID_OBJ(object):
self.data = set()
try:
self.StorageWidth = MAX_SIZE_TYPE[self.PcdDataType]
- self.ValidData = True
except:
self.StorageWidth = 0
- self.ValidData = False
def __eq__(self, validObj):
return validObj and self.VarOffset == validObj.VarOffset