]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/ECC: Add a new type of exception
authorHess Chen <hess.chen@intel.com>
Wed, 30 Jan 2019 08:05:43 +0000 (16:05 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Sat, 2 Feb 2019 02:28:54 +0000 (10:28 +0800)
Add a new type of exception for function body checkpoint.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hess.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/Ecc/c.py

index 50505c10fd6180aa11c0eba98e04e77ee50bb3e7..0c377c6c4a9ba221745ee81a74661707ce04acb3 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 - 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
@@ -1511,7 +1511,7 @@ def CheckFuncLayoutBody(FullFileName):
 \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
@@ -1520,9 +1520,15 @@ def CheckFuncLayoutBody(FullFileName):
         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