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

Chang, Abner via groups.io abner.chang=amd.com at groups.io
Tue Nov 22 06:07:39 UTC 2022


[AMD Official Use Only - General]

Hi Ray,
>From the last week edk2 Bug triage meeting, my understanding from Mike was to remove the entire 5.4.2.2 section and no need to add anything because we already mention at the beginning in CCS to follow C dialect.

@Kinney, Michael D and @Liming Gao, is that correct?
Abner

> -----Original Message-----
> From: Ni, Ray <ray.ni at intel.com>
> Sent: Tuesday, November 22, 2022 1:48 PM
> To: devel at edk2.groups.io; Chang, Abner <Abner.Chang at amd.com>
> Cc: Kinney, Michael D <michael.d.kinney at intel.com>
> Subject: RE: [edk2-devel] [PATCH] edk II C Coding Standard: Remove section
> 5.4.2.2 STATIC
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Abner,
> From what I read, the idea of BZ1766 is to add recommendations to use static
> for local symbols.
>
> "Add recommendations to the EDK II C Coding Standards Specification to use
> 'static' for all functions and global variables that are not referenced outside
> the current C file."
>
> Do you want to capture that in the EDKII C Coding Standard?
>
> Thanks,
> Ray
>
> > -----Original Message-----
> > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Chang,
> > Abner via groups.io
> > Sent: Tuesday, November 22, 2022 12:47 PM
> > To: devel at edk2.groups.io
> > Cc: Ni, Ray <ray.ni at intel.com>; Kinney, Michael D
> > <michael.d.kinney at intel.com>
> > Subject: [edk2-devel] [PATCH] edk II C Coding Standard: Remove section
> > 5.4.2.2 STATIC
> >
> > From: Abner Chang <abner.chang at amd.com>
> >
> > BZ #1766
> >
> > Remove the entire 5.4.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 compatable.
> >
> > Signed-off-by: Abner Chang <abner.chang at amd.com>
> > Cc: Ray Ni <ray.ni at intel.com>
> > Cc: Michael D Kinney <michael.d.kinney at intel.com>
> > ---
> >  5_source_files/54_code_file_structure.md | 16 ----------------
> >  1 file changed, 16 deletions(-)
> >
> > diff --git a/5_source_files/54_code_file_structure.md
> > b/5_source_files/54_code_file_structure.md
> > index 0c4d6a2..9acc620 100644
> > --- a/5_source_files/54_code_file_structure.md
> > +++ b/5_source_files/54_code_file_structure.md
> > @@ -267,19 +267,3 @@ 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
> > -
> > -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.
> > --
> > 2.37.1.windows.1
> >
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#96530):
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk
> 2
> > .groups.io%2Fg%2Fdevel%2Fmessage%2F96530&data=05%7C01%7Ca
> bner.chan
> >
> g%40amd.com%7C29ceedf543b04c89a89908dacc4d1fec%7C3dd8961fe4884e6
> 08e11a
> >
> 82d994e183d%7C0%7C0%7C638046928865773348%7CUnknown%7CTWFpbGZ
> sb3d8eyJWI
> >
> joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%7
> >
> C%7C%7C&sdata=5gN8D7rpLdofeCvfVHorpcHZuirEqzH5VF7ESY3Q%2FV
> o%3D&amp
> > ;reserved=0 Mute This Topic:
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgrou
> >
> ps.io%2Fmt%2F95190239%2F1712937&data=05%7C01%7Cabner.chang%
> 40amd.c
> >
> om%7C29ceedf543b04c89a89908dacc4d1fec%7C3dd8961fe4884e608e11a82d
> 994e18
> >
> 3d%7C0%7C0%7C638046928865773348%7CUnknown%7CTWFpbGZsb3d8eyJ
> WIjoiMC4wLj
> >
> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%
> 7C%7C&a
> >
> mp;sdata=pVcBcsw3eV2TX4X5LdPbKgtl2cv4rny66KfAw4%2B3TH4%3D&r
> eserved
> > =0 Group Owner: devel+owner at edk2.groups.io
> > Unsubscribe:
> >
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk
> 2
> > .groups.io%2Fg%2Fdevel%2Funsub&data=05%7C01%7Cabner.chang%
> 40amd.co
> >
> m%7C29ceedf543b04c89a89908dacc4d1fec%7C3dd8961fe4884e608e11a82d9
> 94e183
> >
> d%7C0%7C0%7C638046928865773348%7CUnknown%7CTWFpbGZsb3d8eyJW
> IjoiMC4wLjA
> >
> wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C
> %7C&am
> >
> p;sdata=WtGbqHANM5gHpI0E9pc4jxoueTuBXppVXNrqryV6iJQ%3D&res
> erved=0
> > [ray.ni at intel.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >



More information about the edk2-devel-archive mailing list