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>
This commit is contained in:
Pierre Gondois
2025-04-30 14:29:25 +02:00
committed by Liming Gao
parent c169a5420b
commit f79717aac2
8 changed files with 0 additions and 126 deletions
@@ -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()
@@ -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 = []
@@ -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
@@ -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 ""
@@ -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
@@ -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):
@@ -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)
@@ -360,13 +358,6 @@ class UniFileClassObject(object):
Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
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
#
@@ -600,26 +591,6 @@ class UniFileClassObject(object):
Item = self.OrderedStringList[Lang][ItemIndexInList]
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
#
@@ -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