public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] BaseTools/ECC: Change check rule for Ifndef statement
@ 2017-04-10  2:57 hesschen
  2017-04-11  5:49 ` Wu, Hao A
  2017-04-11  6:16 ` Zhu, Yonghong
  0 siblings, 2 replies; 3+ messages in thread
From: hesschen @ 2017-04-10  2:57 UTC (permalink / raw)
  To: edk2-devel

Remove the check of Ifndef statement on .c files, only check on .h
files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index a22da3d..062120c 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to define checkpoints used by ECC tool
 #
-# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -941,7 +941,7 @@ class Check(object):
 
     # Check Guid Format in module INF
     def MetaDataFileCheckModuleFileGuidFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Guid Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -984,7 +984,7 @@ class Check(object):
 
     # Check Protocol Format in module INF
     def MetaDataFileCheckModuleFileProtocolFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Protocol Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1015,7 +1015,7 @@ class Check(object):
 
     # Check Ppi Format in module INF
     def MetaDataFileCheckModuleFilePpiFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Ppi Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1043,7 +1043,7 @@ class Check(object):
 
     # Check Pcd Format in module INF
     def MetaDataFileCheckModuleFilePcdFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Pcd Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1139,9 +1139,10 @@ class Check(object):
                         FileTable = 'Identifier' + str(Id)
                         self.NamingConventionCheckDefineStatement(FileTable)
                         self.NamingConventionCheckTypedefStatement(FileTable)
-                        self.NamingConventionCheckIfndefStatement(FileTable)
                         self.NamingConventionCheckVariableName(FileTable)
                         self.NamingConventionCheckSingleCharacterVariable(FileTable)
+                        if os.path.splitext(F)[1] in ('.h'):
+                            self.NamingConventionCheckIfndefStatement(FileTable)
 
         self.NamingConventionCheckPathName()
         self.NamingConventionCheckFunctionName()
@@ -1183,7 +1184,7 @@ class Check(object):
 
     # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
     def NamingConventionCheckIfndefStatement(self, FileTable):
-        if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
 
             SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
-- 
2.7.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] BaseTools/ECC: Change check rule for Ifndef statement
  2017-04-10  2:57 [patch] BaseTools/ECC: Change check rule for Ifndef statement hesschen
@ 2017-04-11  5:49 ` Wu, Hao A
  2017-04-11  6:16 ` Zhu, Yonghong
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2017-04-11  5:49 UTC (permalink / raw)
  To: Chen, Hesheng, edk2-devel@lists.01.org

Reviewed-by: Hao Wu <hao.a.wu@intel.com>

Also tested upon codes in MdePkg\Library\BaseLib, the reported issues for
'#ifndef DISABLE_NEW_DEPRECATED_INTERFACES' used in file
MdePkg\Library\BaseLib\String.c now go away.


Best Regards,
Hao Wu


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> hesschen
> Sent: Monday, April 10, 2017 10:57 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [patch] BaseTools/ECC: Change check rule for Ifndef statement
> 
> Remove the check of Ifndef statement on .c files, only check on .h
> files.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: hesschen <hesheng.chen@intel.com>
> ---
>  BaseTools/Source/Python/Ecc/Check.py | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Ecc/Check.py
> b/BaseTools/Source/Python/Ecc/Check.py
> index a22da3d..062120c 100644
> --- a/BaseTools/Source/Python/Ecc/Check.py
> +++ b/BaseTools/Source/Python/Ecc/Check.py
> @@ -1,7 +1,7 @@
>  ## @file
>  # This file is used to define checkpoints used by ECC tool
>  #
> -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
>  # This program and the accompanying materials
>  # are licensed and made available under the terms and conditions of the BSD
> License
>  # which accompanies this distribution.  The full text of the license may be
> found at
> @@ -941,7 +941,7 @@ class Check(object):
> 
>      # Check Guid Format in module INF
>      def MetaDataFileCheckModuleFileGuidFormat(self):
> -        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or
> EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
> +        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat ==
> '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
>              EdkLogger.quiet("Check Guid Format in module INF ...")
>              Table = EccGlobalData.gDb.TblInf
>              SqlCommand = """
> @@ -984,7 +984,7 @@ class Check(object):
> 
>      # Check Protocol Format in module INF
>      def MetaDataFileCheckModuleFileProtocolFormat(self):
> -        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat
> or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
> +        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat
> == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
>              EdkLogger.quiet("Check Protocol Format in module INF ...")
>              Table = EccGlobalData.gDb.TblInf
>              SqlCommand = """
> @@ -1015,7 +1015,7 @@ class Check(object):
> 
>      # Check Ppi Format in module INF
>      def MetaDataFileCheckModuleFilePpiFormat(self):
> -        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or
> EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
> +        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1'
> or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
>              EdkLogger.quiet("Check Ppi Format in module INF ...")
>              Table = EccGlobalData.gDb.TblInf
>              SqlCommand = """
> @@ -1043,7 +1043,7 @@ class Check(object):
> 
>      # Check Pcd Format in module INF
>      def MetaDataFileCheckModuleFilePcdFormat(self):
> -        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or
> EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
> +        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1'
> or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
>              EdkLogger.quiet("Check Pcd Format in module INF ...")
>              Table = EccGlobalData.gDb.TblInf
>              SqlCommand = """
> @@ -1139,9 +1139,10 @@ class Check(object):
>                          FileTable = 'Identifier' + str(Id)
>                          self.NamingConventionCheckDefineStatement(FileTable)
>                          self.NamingConventionCheckTypedefStatement(FileTable)
> -                        self.NamingConventionCheckIfndefStatement(FileTable)
>                          self.NamingConventionCheckVariableName(FileTable)
>                          self.NamingConventionCheckSingleCharacterVariable(FileTable)
> +                        if os.path.splitext(F)[1] in ('.h'):
> +                            self.NamingConventionCheckIfndefStatement(FileTable)
> 
>          self.NamingConventionCheckPathName()
>          self.NamingConventionCheckFunctionName()
> @@ -1183,7 +1184,7 @@ class Check(object):
> 
>      # Check whether the #ifndef at the start of an include file uses both prefix
> and postfix underscore characters, '_'.
>      def NamingConventionCheckIfndefStatement(self, FileTable):
> -        if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement ==
> '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
> +        if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1'
> or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or
> EccGlobalData.gConfig.CheckAll == '1':
>              EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
> 
>              SqlCommand = """select ID, Value from %s where Model = %s""" %
> (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
> --
> 2.7.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] BaseTools/ECC: Change check rule for Ifndef statement
  2017-04-10  2:57 [patch] BaseTools/ECC: Change check rule for Ifndef statement hesschen
  2017-04-11  5:49 ` Wu, Hao A
@ 2017-04-11  6:16 ` Zhu, Yonghong
  1 sibling, 0 replies; 3+ messages in thread
From: Zhu, Yonghong @ 2017-04-11  6:16 UTC (permalink / raw)
  To: Chen, Hesheng, edk2-devel@lists.01.org

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Chen, Hesheng 
Sent: Monday, April 10, 2017 10:57 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch] BaseTools/ECC: Change check rule for Ifndef statement

Remove the check of Ifndef statement on .c files, only check on .h files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: hesschen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index a22da3d..062120c 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1,7 +1,7 @@
 ## @file
 # This file is used to define checkpoints used by ECC tool  # -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 # This program and the accompanying materials  # are licensed and made available under the terms and conditions of the BSD License  # which accompanies this distribution.  The full text of the license may be found at @@ -941,7 +941,7 @@ class Check(object):
 
     # Check Guid Format in module INF
     def MetaDataFileCheckModuleFileGuidFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Guid Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -984,7 +984,7 @@ class Check(object):
 
     # Check Protocol Format in module INF
     def MetaDataFileCheckModuleFileProtocolFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Protocol Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1015,7 +1015,7 @@ class Check(object):
 
     # Check Ppi Format in module INF
     def MetaDataFileCheckModuleFilePpiFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Ppi Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1043,7 +1043,7 @@ class Check(object):
 
     # Check Pcd Format in module INF
     def MetaDataFileCheckModuleFilePcdFormat(self):
-        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Check Pcd Format in module INF ...")
             Table = EccGlobalData.gDb.TblInf
             SqlCommand = """
@@ -1139,9 +1139,10 @@ class Check(object):
                         FileTable = 'Identifier' + str(Id)
                         self.NamingConventionCheckDefineStatement(FileTable)
                         self.NamingConventionCheckTypedefStatement(FileTable)
-                        self.NamingConventionCheckIfndefStatement(FileTable)
                         self.NamingConventionCheckVariableName(FileTable)
                         self.NamingConventionCheckSingleCharacterVariable(FileTable)
+                        if os.path.splitext(F)[1] in ('.h'):
+                            
+ self.NamingConventionCheckIfndefStatement(FileTable)
 
         self.NamingConventionCheckPathName()
         self.NamingConventionCheckFunctionName()
@@ -1183,7 +1184,7 @@ class Check(object):
 
     # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
     def NamingConventionCheckIfndefStatement(self, FileTable):
-        if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+        if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
 
             SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
--
2.7.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-11  6:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-10  2:57 [patch] BaseTools/ECC: Change check rule for Ifndef statement hesschen
2017-04-11  5:49 ` Wu, Hao A
2017-04-11  6:16 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox