[edk2-devel] [PATCH V2] edk II C Coding Standard: Remove section 5.4.2.2 STATIC

Chang, Abner via groups.io posted 1 patch 1 year, 5 months ago
Failed in applying to current master (apply log)
5_source_files/54_code_file_structure.md    | 19 ++++---------------
5_source_files/56_declarations_and_types.md |  2 +-
2 files changed, 5 insertions(+), 16 deletions(-)
[edk2-devel] [PATCH V2] edk II C Coding Standard: Remove section 5.4.2.2 STATIC
Posted by Chang, Abner via groups.io 1 year, 5 months ago
From: Abner Chang <abner.chang@amd.com>

BZ #1766

Revise the sections that mention the usage of "static" and
remove section 5.4.2.2.1 and 5.4.2.2.2 section.
We are not allowed to use upper-case STATIC in the source
file now.
Just follow C standard and use the lower-case 'static'.

Leave the macro "#deifne STATIC static" there without
removing it to keep the backward compatible.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
---
 5_source_files/54_code_file_structure.md    | 19 ++++---------------
 5_source_files/56_declarations_and_types.md |  2 +-
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/5_source_files/54_code_file_structure.md b/5_source_files/54_code_file_structure.md
index 0c4d6a2..6a9fcc7 100644
--- a/5_source_files/54_code_file_structure.md
+++ b/5_source_files/54_code_file_structure.md
@@ -267,19 +267,8 @@ specified in Section 5.4.1.3 "Compile-Time Names".
 Thus, while it might be legal C, do **not** declare external variables anywhere
 other than at the top level of a file as specified by this document.
 
-#### 5.4.2.2 Static
+#### 5.4.2.2 static
 
-An object declared `STATIC` has either file or block scope.
-
-##### 5.4.2.2.1 Do not reuse an object or function identifier with static storage duration.
-
-Throughout the set of source files defined within a single .inf file, do not
-reuse an identifier with static storage duration. The compiler may not be
-confused by this, but the user may confuse unrelated variables with the same
-name.
-
-##### 5.4.2.2.2 Functions should not be declared STATIC.
-
-Some source-level debuggers are unable to resolve static functions. Until it
-can be verified that no one is dependent upon a debugger with this limitation,
-it is strongly recommended that functions not be declared static.
+Use static for the variables and functions those are non-public to other source
+files is encouraged. This reduces the chances of symbol redefined error during
+link process.
\ No newline at end of file
diff --git a/5_source_files/56_declarations_and_types.md b/5_source_files/56_declarations_and_types.md
index ec1803d..db98b95 100644
--- a/5_source_files/56_declarations_and_types.md
+++ b/5_source_files/56_declarations_and_types.md
@@ -38,7 +38,7 @@
 Any abstract type that is defined must be constructed from other abstract types
 or from common EFI data types.
 
-#### 5.6.1.2 The use of int, unsigned, char, void, static, long is a violation of the coding convention.
+#### 5.6.1.2 The use of int, unsigned, char, void, long and the data types those are defined in EFI Data Types is a violation of the coding convention.
 
 The corresponding EFI types must be used instead.
 
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96631): https://edk2.groups.io/g/devel/message/96631
Mute This Topic: https://groups.io/mt/95269399/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-