]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update ECC to support more doxygen keywords
authorHess Chen <hesheng.chen@intel.com>
Fri, 22 Apr 2016 04:50:23 +0000 (12:50 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 26 Apr 2016 03:20:59 +0000 (11:20 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/Ecc/EccToolError.py
BaseTools/Source/Python/Ecc/c.py

index 5c45fdf904bcfcc193d49f8d2826b1a58e953bd5..1eae9d1364e655492b0234e1b6fe21d583da9470 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Standardized Error Hanlding infrastructures.\r
 #\r
-# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2016, 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
@@ -172,7 +172,7 @@ gEccErrorMessage = {
     ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5",\r
     ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""",\r
     ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section",\r
-    ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par' are allowed to mark the code",\r
+    ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par', '@endcode', '@code', '@{', '@}' are allowed to mark the code",\r
 \r
     ERROR_META_DATA_FILE_CHECK_ALL : "",\r
     ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist",\r
index 256b9e021c265d5a12a74b8fe32114873c720f11..d7b95984385a2e2155968dd7ca123c0a63e3ec14 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to be the c coding style checking of ECC tool\r
 #\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2016, 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
@@ -1568,7 +1568,7 @@ def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId):
     Fields = Value[LBPos + 1 : RBPos]\r
     Fields = StripComments(Fields).strip()\r
     NestPos = Fields.find ('struct')\r
-    if NestPos != -1 and (NestPos + len('struct') < len(Fields)):\r
+    if NestPos != -1 and (NestPos + len('struct') < len(Fields)) and ModelId != DataClass.MODEL_IDENTIFIER_UNION:\r
         if not Fields[NestPos + len('struct') + 1].isalnum():\r
             if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, Name):\r
                 PrintErrorMsg(ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE, 'Nested struct in [%s].' % (Name), FileTable, TdId)\r
@@ -2216,7 +2216,8 @@ def CheckDoxygenCommand(FullFileName):
                        where Model = %d or Model = %d\r
                    """ % (FileTable, DataClass.MODEL_IDENTIFIER_COMMENT, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER)\r
     ResultSet = Db.TblFile.Exec(SqlStatement)\r
-    DoxygenCommandList = ['bug', 'todo', 'example', 'file', 'attention', 'param', 'post', 'pre', 'retval', 'return', 'sa', 'since', 'test', 'note', 'par']\r
+    DoxygenCommandList = ['bug', 'todo', 'example', 'file', 'attention', 'param', 'post', 'pre', 'retval',\r
+                          'return', 'sa', 'since', 'test', 'note', 'par', 'endcode', 'code']\r
     for Result in ResultSet:\r
         CommentStr = Result[0]\r
         CommentPartList = CommentStr.split()\r
@@ -2228,6 +2229,10 @@ def CheckDoxygenCommand(FullFileName):
             if Part.startswith('@'):\r
                 if EccGlobalData.gException.IsException(ERROR_DOXYGEN_CHECK_COMMAND, Part):\r
                     continue\r
+                if not Part.replace('@', '').strip():\r
+                    continue\r
+                if Part.lstrip('@') in ['{', '}']:\r
+                    continue\r
                 if Part.lstrip('@').isalpha():\r
                     if Part.lstrip('@') not in DoxygenCommandList:\r
                         PrintErrorMsg(ERROR_DOXYGEN_CHECK_COMMAND, 'Unknown doxygen command %s' % Part, FileTable, Result[1])\r