## @file\r
# This file is used to be the c coding style checking of ECC tool\r
#\r
-# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
\r
FileTable = 'Identifier' + str(FileID)\r
Db = GetDB()\r
- SqlStatement = """ select BodyStartColumn, EndColumn, ID\r
+ SqlStatement = """ select BodyStartColumn, EndColumn, ID, Name\r
from Function\r
where BelongsToFile = %d\r
""" % (FileID)\r
return ErrorMsgList\r
for Result in ResultSet:\r
if Result[0] != 0:\r
- PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'open brace should be at the very beginning of a line.', 'Function', Result[2])\r
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, Result[3]):\r
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,\r
+ 'The open brace should be at the very beginning of a line for the function [%s].' % Result[3],\r
+ 'Function', Result[2])\r
if Result[1] != 0:\r
- PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, 'close brace should be at the very beginning of a line.', 'Function', Result[2])\r
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY, Result[3]):\r
+ PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY,\r
+ 'The close brace should be at the very beginning of a line for the function [%s].' % Result[3],\r
+ 'Function', Result[2])\r
\r
def CheckFuncLayoutLocalVariable(FullFileName):\r
ErrorMsgList = []\r
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
\r
\r
-def CheckHeaderFileData(FullFileName):\r
+def CheckHeaderFileData(FullFileName, AllTypedefFun=[]):\r
ErrorMsgList = []\r
\r
FileID = GetTableID(FullFileName, ErrorMsgList)\r
ResultSet = Db.TblFile.Exec(SqlStatement)\r
for Result in ResultSet:\r
if not Result[1].startswith('extern'):\r
- PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])\r
+ for Item in AllTypedefFun:\r
+ if '(%s)' % Result[1] in Item:\r
+ break\r
+ else:\r
+ PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])\r
\r
SqlStatement = """ select ID\r
from Function\r