public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools:ECC need to handle lower case 'static'
@ 2019-09-04  9:54 Fan, ZhijuX
  2019-09-09  2:41 ` Bob Feng
  0 siblings, 1 reply; 2+ messages in thread
From: Fan, ZhijuX @ 2019-09-04  9:54 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C

[-- Attachment #1: Type: text/plain, Size: 4432 bytes --]

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1778

We are going to add keyword (lower case) 'static' for functions and global
variables which are not referenced outside their current C file.

However, the ECC tool only recognizes upper case 'STATIC' at this moment.
This will lead to issue reports for new codes that follow the above coding
style.

This patch is going to handle lower case 'static'

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py         | 2 +-
 BaseTools/Source/Python/Ecc/Configuration.py | 2 +-
 BaseTools/Source/Python/Ecc/EccToolError.py  | 2 +-
 BaseTools/Source/Python/Ecc/c.py             | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 86bb8562ba..2180818609 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -441,7 +441,7 @@ class Check(object):
         self.DeclCheckUnionType()
 
 
-    # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
+    # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
     def DeclCheckNoUseCType(self):
         if EccGlobalData.gConfig.DeclarationDataTypeCheckNoUseCType == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking Declaration No use C type ...")
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index 57ae932ed2..9d9feaca5e 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -256,7 +256,7 @@ class Configuration(object):
         ## Declarations and Data Types Checking
         self.DeclarationDataTypeCheckAll = 0
 
-        # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
+        # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
         self.DeclarationDataTypeCheckNoUseCType = 1
         # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
         self.DeclarationDataTypeCheckInOutModifier = 1
diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccToolError.py
index 4b1bef6a3e..0ff3b42674 100644
--- a/BaseTools/Source/Python/Ecc/EccToolError.py
+++ b/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -149,7 +149,7 @@ gEccErrorMessage = {
     ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the include file with same names",
 
     ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "",
-    ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, static, long in any .c, .h or .asl files",
+    ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files",
     ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers IN, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to a function and should not appear in a data type declaration""",
     ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols",
     ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type should have a 'typedef' and the name must be in capital letters",
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 2a73da7cb8..a99b40a701 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1859,7 +1859,7 @@ def CheckDeclNoUseCType(FullFileName):
                        where Model = %d
                    """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE)
     ResultSet = Db.TblFile.Exec(SqlStatement)
-    CTypeTuple = ('int', 'unsigned', 'char', 'void', 'static', 'long')
+    CTypeTuple = ('int', 'unsigned', 'char', 'void', 'long')
     for Result in ResultSet:
         for Type in CTypeTuple:
             if PatternInModifier(Result[0], Type):
-- 
2.14.1.windows.1


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 5021 bytes --]

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

* Re: [PATCH] BaseTools:ECC need to handle lower case 'static'
  2019-09-04  9:54 [PATCH] BaseTools:ECC need to handle lower case 'static' Fan, ZhijuX
@ 2019-09-09  2:41 ` Bob Feng
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Feng @ 2019-09-09  2:41 UTC (permalink / raw)
  To: Fan, ZhijuX, devel@edk2.groups.io; +Cc: Gao, Liming

Reviewed-by: Bob Feng <bob.c.feng@intel.com> 

-----Original Message-----
From: Fan, ZhijuX 
Sent: Wednesday, September 4, 2019 5:54 PM
To: devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [PATCH] BaseTools:ECC need to handle lower case 'static'

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1778

We are going to add keyword (lower case) 'static' for functions and global variables which are not referenced outside their current C file.

However, the ECC tool only recognizes upper case 'STATIC' at this moment.
This will lead to issue reports for new codes that follow the above coding style.

This patch is going to handle lower case 'static'

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py         | 2 +-
 BaseTools/Source/Python/Ecc/Configuration.py | 2 +-  BaseTools/Source/Python/Ecc/EccToolError.py  | 2 +-
 BaseTools/Source/Python/Ecc/c.py             | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 86bb8562ba..2180818609 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -441,7 +441,7 @@ class Check(object):
         self.DeclCheckUnionType()
 
 
-    # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
+    # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
     def DeclCheckNoUseCType(self):
         if EccGlobalData.gConfig.DeclarationDataTypeCheckNoUseCType == '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking Declaration No use C type ...") diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index 57ae932ed2..9d9feaca5e 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -256,7 +256,7 @@ class Configuration(object):
         ## Declarations and Data Types Checking
         self.DeclarationDataTypeCheckAll = 0
 
-        # Check whether no use of int, unsigned, char, void, static, long in any .c, .h or .asl files.
+        # Check whether no use of int, unsigned, char, void, long in any .c, .h or .asl files.
         self.DeclarationDataTypeCheckNoUseCType = 1
         # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are used only to qualify arguments to a function and should not appear in a data type declaration
         self.DeclarationDataTypeCheckInOutModifier = 1 diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccToolError.py
index 4b1bef6a3e..0ff3b42674 100644
--- a/BaseTools/Source/Python/Ecc/EccToolError.py
+++ b/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -149,7 +149,7 @@ gEccErrorMessage = {
     ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the include file with same names",
 
     ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "",
-    ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, static, long in any .c, .h or .asl files",
+    ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be 
+ no use of int, unsigned, char, void, long in any .c, .h or .asl 
+ files",
     ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers IN, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to a function and should not appear in a data type declaration""",
     ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols",
     ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type should have a 'typedef' and the name must be in capital letters", diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 2a73da7cb8..a99b40a701 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -1859,7 +1859,7 @@ def CheckDeclNoUseCType(FullFileName):
                        where Model = %d
                    """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE)
     ResultSet = Db.TblFile.Exec(SqlStatement)
-    CTypeTuple = ('int', 'unsigned', 'char', 'void', 'static', 'long')
+    CTypeTuple = ('int', 'unsigned', 'char', 'void', 'long')
     for Result in ResultSet:
         for Type in CTypeTuple:
             if PatternInModifier(Result[0], Type):
--
2.14.1.windows.1


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

end of thread, other threads:[~2019-09-09  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-04  9:54 [PATCH] BaseTools:ECC need to handle lower case 'static' Fan, ZhijuX
2019-09-09  2:41 ` Bob Feng

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