summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Ecc
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-18 05:04:32 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-18 05:04:32 +0000
commit40d841f6a8f84e75409178e19e69b95e01bada0f (patch)
tree75b50fad9fc4190bf505ac99c283064ec8c79f2b /BaseTools/Source/Python/Ecc
parent3dc8585e0a9fd4b2cb383f3ceb4961c7a88a8e71 (diff)
downloadedk2-platforms-40d841f6a8f84e75409178e19e69b95e01bada0f.tar.xz
Sync EDKII BaseTools to BaseTools project r1971
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10502 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Ecc')
-rw-r--r--BaseTools/Source/Python/Ecc/C.g4
-rw-r--r--BaseTools/Source/Python/Ecc/CLexer.py2
-rw-r--r--BaseTools/Source/Python/Ecc/CParser.py2
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py49
-rw-r--r--BaseTools/Source/Python/Ecc/CodeFragment.py4
-rw-r--r--BaseTools/Source/Python/Ecc/CodeFragmentCollector.py4
-rw-r--r--BaseTools/Source/Python/Ecc/Configuration.py8
-rw-r--r--BaseTools/Source/Python/Ecc/Database.py4
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py4
-rw-r--r--BaseTools/Source/Python/Ecc/EccGlobalData.py4
-rw-r--r--BaseTools/Source/Python/Ecc/EccToolError.py7
-rw-r--r--BaseTools/Source/Python/Ecc/Exception.py4
-rw-r--r--BaseTools/Source/Python/Ecc/FileProfile.py4
-rw-r--r--BaseTools/Source/Python/Ecc/MetaDataParser.py4
-rw-r--r--BaseTools/Source/Python/Ecc/ParserWarning.py4
-rw-r--r--BaseTools/Source/Python/Ecc/__init__.py4
-rw-r--r--BaseTools/Source/Python/Ecc/c.py4
-rw-r--r--BaseTools/Source/Python/Ecc/config.ini6
-rw-r--r--BaseTools/Source/Python/Ecc/exception.xml3
19 files changed, 86 insertions, 39 deletions
diff --git a/BaseTools/Source/Python/Ecc/C.g b/BaseTools/Source/Python/Ecc/C.g
index a34f5902bb..e344088f36 100644
--- a/BaseTools/Source/Python/Ecc/C.g
+++ b/BaseTools/Source/Python/Ecc/C.g
@@ -1,8 +1,8 @@
/* @file
This file is used to be the grammar file of ECC tool
- Copyright (c) 2009 - 2010, Intel Corporation
- All rights reserved. This program and the accompanying materials
+ Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/CLexer.py b/BaseTools/Source/Python/Ecc/CLexer.py
index 947ac4c8e3..a72d4ee3c2 100644
--- a/BaseTools/Source/Python/Ecc/CLexer.py
+++ b/BaseTools/Source/Python/Ecc/CLexer.py
@@ -10,7 +10,7 @@ from antlr3.compat import set, frozenset
# This file is generated by running:
# java org.antlr.Tool C.g
#
-# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py
index e56a79a43d..511d429f26 100644
--- a/BaseTools/Source/Python/Ecc/CParser.py
+++ b/BaseTools/Source/Python/Ecc/CParser.py
@@ -10,7 +10,7 @@ from antlr3.compat import set, frozenset
# This file is generated by running:
# java org.antlr.Tool C.g
#
-# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index a8ec638fce..dbfedb514b 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1,8 +1,8 @@
## @file
# This file is used to define checkpoints used by ECC tool
#
-# Copyright (c) 2008 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
@@ -341,9 +341,19 @@ class Check(object):
for Dirpath, Dirnames, Filenames in self.WalkTree():
for F in Filenames:
- if os.path.splitext(F)[1] in ('.h', '.c'):
+ Ext = os.path.splitext(F)[1]
+ if Ext in ('.h', '.c'):
FullName = os.path.join(Dirpath, F)
MsgList = c.CheckFileHeaderDoxygenComments(FullName)
+ elif Ext in ('.inf', '.dec', '.dsc', '.fdf'):
+ FullName = os.path.join(Dirpath, F)
+ if not open(FullName).read().startswith('## @file'):
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FullName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'INF/DEC/DSC/FDF file header comment should begin with ""## @file""'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
def DoxygenCheckFunctionHeader(self):
@@ -399,6 +409,7 @@ class Check(object):
self.MetaDataFileCheckGuidDuplicate()
self.MetaDataFileCheckModuleFileNoUse()
self.MetaDataFileCheckPcdType()
+ self.MetaDataFileCheckModuleFileGuidDuplication()
# Check whether each file defined in meta-data exists
def MetaDataFileCheckPathName(self):
@@ -692,6 +703,38 @@ class Check(object):
#ERROR_META_DATA_FILE_CHECK_PCD_TYPE
pass
+ # Internal worker function to get the INF workspace relative path from FileID
+ def GetInfFilePathFromID(self, FileID):
+ Table = EccGlobalData.gDb.TblFile
+ SqlCommand = """select A.FullPath from %s as A where A.ID = %s""" % (Table.Table, FileID)
+ RecordSet = Table.Exec(SqlCommand)
+ Path = ""
+ for Record in RecordSet:
+ Path = Record[0].replace(EccGlobalData.gWorkspace, '')
+ if Path.startswith('\\') or Path.startswith('/'):
+ Path = Path[1:]
+ return Path
+
+ # Check whether two module INFs under one workspace has the same FILE_GUID value
+ def MetaDataFileCheckModuleFileGuidDuplication(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidDuplication == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking for pcd type in c code function usage ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select A.ID, A.Value2, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B
+ where A.Value1 = 'FILE_GUID' and B.Value1 = 'FILE_GUID' and
+ A.Value2 = B.Value2 and A.ID <> B.ID group by A.ID
+ """ % (Table.Table, Table.Table)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ InfPath1 = self.GetInfFilePathFromID(Record[2])
+ InfPath2 = self.GetInfFilePathFromID(Record[3])
+ if InfPath1 and InfPath2:
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1):
+ Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2)
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg = Msg, BelongsToTable = Table.Table, BelongsToItem = Record[0])
+
+
# Check whether these is duplicate Guid/Ppi/Protocol name
def CheckGuidProtocolPpi(self, ErrorID, Model, Table):
Name = ''
diff --git a/BaseTools/Source/Python/Ecc/CodeFragment.py b/BaseTools/Source/Python/Ecc/CodeFragment.py
index 1c5c5e4df2..3bf1c45150 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragment.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragment.py
@@ -1,9 +1,9 @@
## @file
# fragments of source file
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
-# All rights reserved. This program and the accompanying materials
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
index d95faeef6a..134b15f81e 100644
--- a/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
@@ -1,9 +1,9 @@
## @file
# preprocess source file
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
-# All rights reserved. This program and the accompanying materials
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index bd9313cef4..310cb5716b 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -1,8 +1,8 @@
## @file
# This file is used to define class Configuration
#
-# Copyright (c) 2008, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
@@ -222,7 +222,9 @@ class Configuration(object):
self.MetaDataFileCheckModuleFileNoUse = 1
# Check whether the PCD is correctly used in C function via its type
self.MetaDataFileCheckPcdType = 1
-
+ # Check whether there are FILE_GUID duplication among different INF files
+ self.MetaDataFileCheckModuleFileGuidDuplication = 1
+
#
# The check points in this section are reserved
#
diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py
index c9311f65a5..9520be4345 100644
--- a/BaseTools/Source/Python/Ecc/Database.py
+++ b/BaseTools/Source/Python/Ecc/Database.py
@@ -1,8 +1,8 @@
## @file
# This file is used to create a database used by ECC tool
#
-# Copyright (c) 2007 ~ 2008, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index 4b5c319c35..62b265bbaa 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -1,8 +1,8 @@
## @file
# This file is used to be the main entrance of ECC tool
#
-# Copyright (c) 2009 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/EccGlobalData.py b/BaseTools/Source/Python/Ecc/EccGlobalData.py
index 8e8f24b8c8..29e4aca0d0 100644
--- a/BaseTools/Source/Python/Ecc/EccGlobalData.py
+++ b/BaseTools/Source/Python/Ecc/EccGlobalData.py
@@ -1,8 +1,8 @@
## @file
# This file is used to save global datas used by ECC tool
#
-# Copyright (c) 2008, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccToolError.py
index f6c4097e78..985737f192 100644
--- a/BaseTools/Source/Python/Ecc/EccToolError.py
+++ b/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -1,8 +1,8 @@
## @file
# Standardized Error Hanlding infrastructures.
#
-# Copyright (c) 2008 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
@@ -92,6 +92,7 @@ ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL = 10012
ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI = 10013
ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE = 10014
ERROR_META_DATA_FILE_CHECK_PCD_TYPE = 10015
+ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION = 10016
ERROR_SPELLING_CHECK_ALL = 11000
@@ -177,7 +178,7 @@ gEccErrorMessage = {
ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI : "Duplicate PPI found",
ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE : "No used module files found",
ERROR_META_DATA_FILE_CHECK_PCD_TYPE : "Wrong C code function used for this kind of PCD",
-
+ ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION : "Module file has FILE_GUID collision with other module file",
ERROR_SPELLING_CHECK_ALL : "",
}
diff --git a/BaseTools/Source/Python/Ecc/Exception.py b/BaseTools/Source/Python/Ecc/Exception.py
index 733408551a..ff8736059f 100644
--- a/BaseTools/Source/Python/Ecc/Exception.py
+++ b/BaseTools/Source/Python/Ecc/Exception.py
@@ -1,8 +1,8 @@
## @file
# This file is used to parse exception items found by ECC tool
#
-# Copyright (c) 2009, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/FileProfile.py b/BaseTools/Source/Python/Ecc/FileProfile.py
index 810087ea07..689aee0975 100644
--- a/BaseTools/Source/Python/Ecc/FileProfile.py
+++ b/BaseTools/Source/Python/Ecc/FileProfile.py
@@ -1,9 +1,9 @@
## @file
# fragments of source file
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
-# All rights reserved. This program and the accompanying materials
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py
index fb4239f474..36ad6e492f 100644
--- a/BaseTools/Source/Python/Ecc/MetaDataParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py
@@ -1,8 +1,8 @@
## @file
# This file is used to define common parser functions for meta-data
#
-# Copyright (c) 2008, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/ParserWarning.py b/BaseTools/Source/Python/Ecc/ParserWarning.py
index 1874739915..a52c78ec31 100644
--- a/BaseTools/Source/Python/Ecc/ParserWarning.py
+++ b/BaseTools/Source/Python/Ecc/ParserWarning.py
@@ -1,8 +1,8 @@
## @file
# This file is used to be the warning class of ECC tool
#
-# Copyright (c) 2009 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/__init__.py b/BaseTools/Source/Python/Ecc/__init__.py
index f385b1e670..880ad499f4 100644
--- a/BaseTools/Source/Python/Ecc/__init__.py
+++ b/BaseTools/Source/Python/Ecc/__init__.py
@@ -4,8 +4,8 @@
# This file is required to make Python interpreter treat the directory
# as containing package.
#
-# Copyright (c) 2007 - 2010, Intel Corporation<BR>
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 1085da942b..941392be0f 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1,8 +1,8 @@
## @file
# This file is used to be the c coding style checking of ECC tool
#
-# Copyright (c) 2009 - 2010, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini
index a3215aedaa..973bc68b38 100644
--- a/BaseTools/Source/Python/Ecc/config.ini
+++ b/BaseTools/Source/Python/Ecc/config.ini
@@ -2,8 +2,8 @@
# This file is used to set configuration of ECC tool
# For the items listed below, 1 means valid, 0 means invalid
#
-# Copyright (c) 2007, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
@@ -233,6 +233,8 @@ MetaDataFileCheckGuidDuplicate = 1
MetaDataFileCheckModuleFileNoUse = 1
# Check whether the PCD is correctly used in C function via its type
MetaDataFileCheckPcdType = 1
+# Check whether there are FILE_GUID duplication among different INF files
+MetaDataFileCheckModuleFileGuidDuplication = 1
#
# The check points in this section are reserved
diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml
index 58cb600e46..9102de6fef 100644
--- a/BaseTools/Source/Python/Ecc/exception.xml
+++ b/BaseTools/Source/Python/Ecc/exception.xml
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ExceptionList xmlns="http://www.uefi.org/2008/2.1" xmlns:xsi="http:/www.w3.org/2001/XMLSchema-instance">
- <Copyright>Copyright (c) 2009 - 2010, Intel Corporation.</Copyright>
+ <Copyright>Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.</Copyright>
<License>
- All rights reserved.
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this distribution.
The full text of the license may be found at http://opensource.org/licenses/bsd-license.php