]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/ECC: Change check rule for Ifndef statement
authorHess Chen <hesheng.chen@intel.com>
Mon, 10 Apr 2017 02:57:18 +0000 (10:57 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 11 Apr 2017 06:36:53 +0000 (14:36 +0800)
Remove the check of Ifndef statement on .c files, only check on .h
files.

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/Check.py

index a22da3d85a1d0d24a93258bbd96ef2fd3a5062b0..062120c0e51a8288934ce66ea6348611554de7e2 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to define checkpoints used by ECC tool\r
 #\r
-# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2017, 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
@@ -941,7 +941,7 @@ class Check(object):
 \r
     # Check Guid Format in module INF\r
     def MetaDataFileCheckModuleFileGuidFormat(self):\r
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Check Guid Format in module INF ...")\r
             Table = EccGlobalData.gDb.TblInf\r
             SqlCommand = """\r
@@ -984,7 +984,7 @@ class Check(object):
 \r
     # Check Protocol Format in module INF\r
     def MetaDataFileCheckModuleFileProtocolFormat(self):\r
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Check Protocol Format in module INF ...")\r
             Table = EccGlobalData.gDb.TblInf\r
             SqlCommand = """\r
@@ -1015,7 +1015,7 @@ class Check(object):
 \r
     # Check Ppi Format in module INF\r
     def MetaDataFileCheckModuleFilePpiFormat(self):\r
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Check Ppi Format in module INF ...")\r
             Table = EccGlobalData.gDb.TblInf\r
             SqlCommand = """\r
@@ -1043,7 +1043,7 @@ class Check(object):
 \r
     # Check Pcd Format in module INF\r
     def MetaDataFileCheckModuleFilePcdFormat(self):\r
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Check Pcd Format in module INF ...")\r
             Table = EccGlobalData.gDb.TblInf\r
             SqlCommand = """\r
@@ -1139,9 +1139,10 @@ class Check(object):
                         FileTable = 'Identifier' + str(Id)\r
                         self.NamingConventionCheckDefineStatement(FileTable)\r
                         self.NamingConventionCheckTypedefStatement(FileTable)\r
-                        self.NamingConventionCheckIfndefStatement(FileTable)\r
                         self.NamingConventionCheckVariableName(FileTable)\r
                         self.NamingConventionCheckSingleCharacterVariable(FileTable)\r
+                        if os.path.splitext(F)[1] in ('.h'):\r
+                            self.NamingConventionCheckIfndefStatement(FileTable)\r
 \r
         self.NamingConventionCheckPathName()\r
         self.NamingConventionCheckFunctionName()\r
@@ -1183,7 +1184,7 @@ class Check(object):
 \r
     # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.\r
     def NamingConventionCheckIfndefStatement(self, FileTable):\r
-        if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+        if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Checking naming covention of #ifndef statement ...")\r
 \r
             SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)\r