public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2] edk II C Coding Standard: Remove section 5.4.2.2 STATIC
@ 2022-11-26  9:02 Chang, Abner
  0 siblings, 0 replies; only message in thread
From: Chang, Abner @ 2022-11-26  9:02 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Michael D Kinney

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-26  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-26  9:02 [PATCH V2] edk II C Coding Standard: Remove section 5.4.2.2 STATIC Chang, Abner

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