From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Chang, Abner" <Abner.Chang@amd.com>,
"Ni, Ray" <ray.ni@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Gao, Liming" <gaoliming@byosoft.com.cn>
Subject: Re: [edk2-devel] [PATCH] edk II C Coding Standard: Remove section 5.4.2.2 STATIC
Date: Tue, 22 Nov 2022 16:31:38 +0000 [thread overview]
Message-ID: <CO1PR11MB4929407CCB919C67DF0C0F25D20D9@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN2PR12MB39661939E99DEA0A2882ADDFEA0D9@MN2PR12MB3966.namprd12.prod.outlook.com>
Hi Abner,
Removing that section 5.4.2.2 is required to close this bug.
Meaning of 'static' is covered by the ANSI C standards.
Use of 'static' for non-public variable/functions in EDK II
libraries/modules is recommended.
However, it is not required. It is recommended to reduce chances
of symbol conflicts at link time. Current approach is if a link
failure occurs for multiply defined symbols and those are non-public
symbols, the 'static' attribute can be applied to the non-public
symbols in the components that generated the link failure.
It may be good to mention this recommendation in the CSS.
I will let you decide when this recommendation needs to be
added to CSS.
Mike
> -----Original Message-----
> From: Chang, Abner <Abner.Chang@amd.com>
> Sent: Monday, November 21, 2022 10:08 PM
> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> Subject: RE: [edk2-devel] [PATCH] edk II C Coding Standard: Remove section 5.4.2.2 STATIC
>
> [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@intel.com>
> > Sent: Tuesday, November 22, 2022 1:48 PM
> > To: devel@edk2.groups.io; Chang, Abner <Abner.Chang@amd.com>
> > Cc: Kinney, Michael D <michael.d.kinney@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@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> > > Abner via groups.io
> > > Sent: Tuesday, November 22, 2022 12:47 PM
> > > To: devel@edk2.groups.io
> > > Cc: Ni, Ray <ray.ni@intel.com>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>
> > > Subject: [edk2-devel] [PATCH] edk II C Coding Standard: Remove section
> > > 5.4.2.2 STATIC
> > >
> > > From: Abner Chang <abner.chang@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@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 | 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
> > >
> > >
> > >
> > >
> > >
next prev parent reply other threads:[~2022-11-22 18:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 4:47 [PATCH] edk II C Coding Standard: Remove section 5.4.2.2 STATIC Chang, Abner
2022-11-22 5:48 ` [edk2-devel] " Ni, Ray
2022-11-22 6:07 ` Chang, Abner
2022-11-22 16:31 ` Michael D Kinney [this message]
2022-11-22 22:12 ` Pedro Falcato
2022-11-22 22:39 ` Michael D Kinney
2022-11-26 7:44 ` Chang, Abner
2022-11-28 9:08 ` Ard Biesheuvel
2022-11-28 15:41 ` Michael D Kinney
2022-12-12 5:30 ` Chang, Abner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO1PR11MB4929407CCB919C67DF0C0F25D20D9@CO1PR11MB4929.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox