Skip to content

Commit

Permalink
1. Fix a bug when parsing empty typedef name.
Browse files Browse the repository at this point in the history
2. Modify config.ini to support two new checkpoints.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1267 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
hche10x committed Jun 20, 2008
1 parent a952eb1 commit 271529a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
17 changes: 9 additions & 8 deletions Source/Python/Ecc/Check.py
Expand Up @@ -751,14 +751,15 @@ def NamingConventionCheckTypedefStatement(self):
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
Name = Record[1].strip()
if Name[0] == '(':
Name = Name[1:Name.find(')')]
if Name.find('(') > -1:
Name = Name[Name.find('(') + 1 : Name.find(')')]
Name = Name.replace('WINAPI', '')
Name = Name.replace('*', '').strip()
if Name.upper() != Name:
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg = "The #typedef name '%s' does not follow the rules" % (Name), BelongsToTable = IdentifierTable, BelongsToItem = Record[0])
if Name != '' and Name != None:
if Name[0] == '(':
Name = Name[1:Name.find(')')]
if Name.find('(') > -1:
Name = Name[Name.find('(') + 1 : Name.find(')')]
Name = Name.replace('WINAPI', '')
Name = Name.replace('*', '').strip()
if Name.upper() != Name:
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg = "The #typedef name '%s' does not follow the rules" % (Name), BelongsToTable = IdentifierTable, BelongsToItem = Record[0])

#
# Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
Expand Down
55 changes: 30 additions & 25 deletions Source/Python/Ecc/config.ini
Expand Up @@ -41,7 +41,7 @@ AutoCorrect = 1
#
# List customized Modifer here, split with ','
#
ModifierList = IN, OUT, OPTIONAL, UNALIGNED, EFI_RUNTIMESERVICE, EFI_BOOTSERVICE, EFIAPI, TPMINTERNALAPI
ModifierList = IN, OUT, OPTIONAL, UNALIGNED, EFI_RUNTIMESERVICE, EFI_BOOTSERVICE, EFIAPI

#
# General Checking
Expand Down Expand Up @@ -80,11 +80,11 @@ SpaceCheckAll = 1
PredicateExpressionCheckAll = 0

# Check whether Boolean values, variable type BOOLEAN not use explicit comparisons to TRUE or FALSE
PredicateExpressionCheckBooleanValue = 1
PredicateExpressionCheckBooleanValue = -1
# Check whether Non-Boolean comparisons use a compare operator (==, !=, >, < >=, <=).
PredicateExpressionCheckNonBooleanOperator = 1
PredicateExpressionCheckNonBooleanOperator = -1
# Check whether a comparison of any pointer to zero must be done via the NULL type
PredicateExpressionCheckComparisonNullType = 1
PredicateExpressionCheckComparisonNullType = -1

#
# Headers Checking
Expand All @@ -102,53 +102,57 @@ HeaderCheckFunction = 1
CFunctionLayoutCheckAll = 0

# Check whether return type exists and in the first line
CFunctionLayoutCheckReturnType = 1
CFunctionLayoutCheckReturnType = -1
# Check whether any optional functional modifiers exist and next to the return type
CFunctionLayoutCheckOptionalFunctionalModifier = 1
CFunctionLayoutCheckOptionalFunctionalModifier = -1
# Check whether the next line contains the function name, left justified, followed by the beginning of the parameter list
# Check whether the closing parenthesis is on its own line and also indented two spaces
CFunctionLayoutCheckFunctionName = 1
CFunctionLayoutCheckFunctionName = -1
# Check whether the function prototypes in include files have the same form as function definitions
CFunctionLayoutCheckFunctionPrototype = 1
CFunctionLayoutCheckFunctionPrototype = -1
# Check whether the body of a function is contained by open and close braces that must be in the first column
CFunctionLayoutCheckFunctionBody = 1
CFunctionLayoutCheckFunctionBody = -1
# Check whether the data declarations is the first code in a module.
CFunctionLayoutCheckDataDeclaration = 1
CFunctionLayoutCheckDataDeclaration = -1
# Check whether no initialization of a variable as part of its declaration
CFunctionLayoutCheckNoInitOfVariable = 1
CFunctionLayoutCheckNoInitOfVariable = -1
# Check whether no use of STATIC for functions
CFunctionLayoutCheckNoStatic = 1
CFunctionLayoutCheckNoStatic = -1

#
# Include Files Checking
#
IncludeFileCheckAll = 0

#Check whether having include files with same name
IncludeFileCheckSameName = 1
# Check whether all include file contents is guarded by a #ifndef statement.
# the #ifndef must be the first line of code following the file header comment
# the #endif must appear on the last line in the file
IncludeFileCheckIfndefStatement = 1
IncludeFileCheckIfndefStatement = -1
# Check whether include files contain only public or only private data
# Check whether include files NOT contain code or define data variables
IncludeFileCheckData = 1
IncludeFileCheckData = -1

#
# Declarations and Data Types Checking
#
DeclarationDataTypeCheckAll = 0

# Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
DeclarationDataTypeCheckNoUseCType = 1
DeclarationDataTypeCheckNoUseCType = -1
# Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
DeclarationDataTypeCheckInOutModifier = 1
DeclarationDataTypeCheckInOutModifier = -1
# Check whether the EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols
DeclarationDataTypeCheckEFIAPIModifier = 1
DeclarationDataTypeCheckEFIAPIModifier = -1
# Check whether Enumerated Type has a 'typedef' and the name is capital
DeclarationDataTypeCheckEnumeratedType = 1
DeclarationDataTypeCheckEnumeratedType = -1
# Check whether Structure Type has a 'typedef' and the name is capital
DeclarationDataTypeCheckStructureDeclaration = 1
DeclarationDataTypeCheckStructureDeclaration = -1
# Check whether having same Structure
DeclarationDataTypeCheckSameStructure = 1
# Check whether Union Type has a 'typedef' and the name is capital
DeclarationDataTypeCheckUnionType = 1
DeclarationDataTypeCheckUnionType = -1


#
Expand All @@ -166,6 +170,7 @@ NamingConventionCheckIfndefStatement = 1
# 1. First character should be upper case
# 2. Existing lower case in a word
# 3. No space existence
# 4. Global variable name must start by a 'g'
# Check whether the path name followed the rule
NamingConventionCheckPathName = 1
# Check whether the variable name followed the rule
Expand All @@ -181,16 +186,16 @@ NamingConventionCheckSingleCharacterVariable = 1
DoxygenCheckAll = 0

# Check whether the file headers are followed Doxygen special documentation blocks in section 2.3.5
DoxygenCheckFileHeader = 1
DoxygenCheckFileHeader = -1
# Check whether the function headers are followed Doxygen special documentation blocks in section 2.3.5
DoxygenCheckFunctionHeader = 1
DoxygenCheckFunctionHeader = -1
# Check whether the first line of text in a comment block is a brief description of the element being documented.
# The brief description must end with a period.
DoxygenCheckCommentDescription = 1
DoxygenCheckCommentDescription = -1
# Check whether comment lines with '///< ... text ...' format, if it is used, it should be after the code section.
DoxygenCheckCommentFormat = 1
DoxygenCheckCommentFormat = -1
# Check whether only Doxygen commands allowed to mark the code are @bug and @todo.
DoxygenCheckCommand = 1
DoxygenCheckCommand = -1

#
# Meta-Data File Processing Checking
Expand Down

0 comments on commit 271529a

Please sign in to comment.