On Wed, 24 Apr 2019 at 18:59, Kinney, Michael D <michael.d.kin...@intel.com> wrote: > > Hi Ard, > > I see a mix of use of 'static' and 'STATIC' in the sources. > > The reason to use STATIC is if it needs to be replaced with > something other than 'static' for a specific compiler or > debug scenario. > > Long ago, there were some source level debug issue with > 'static' symbols, so using the macro STATIC was preferred > so it could be mapped to nothing for a debug scenario. That > issue no long exists. > > Do you know of a reason today to map 'STATIC' to anything > Other than 'static'? > > I also looked at the EDK II C Coding Standard. It is also > inconsistent and had references to both 'static' and 'STATIC'. > We should enter a few BZs to update that doc once we have > clear guidance from this discussion. >
I wasn't aware that lower case static is also in use, so I was simply extrapolating from personal experience. i think there should be no reason to use the preprocessor to change 'static' into something else, and so I'm happy to settle on lowercase static, as long as we are consistent. But more importantly, now that this has come up, what I would like to do is make 'static' mandatory unless the code requires otherwise: this results in much better code generation (given that the compiler can infer constness for non-const static variables but not for ones with external linkage) and generally improves programmer hygiene when it comes to linking to arbitrary symbols that are really internal to a library. > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] > > On Behalf Of Ard Biesheuvel > > Sent: Wednesday, April 24, 2019 1:07 AM > > To: edk2-devel-groups-io <devel@edk2.groups.io>; Gao, > > Zhichao <zhichao....@intel.com> > > Cc: Laszlo Ersek <ler...@redhat.com>; Kinney, Michael D > > <michael.d.kin...@intel.com>; Gao, Liming > > <liming....@intel.com>; Bi, Dandan <dandan...@intel.com> > > Subject: Re: [edk2-devel] [PATCH V2 3/8] > > MdePkg/UefiDebugLibStdErr: Decrease the name collisions > > > > On Wed, 24 Apr 2019 at 06:59, Gao, Zhichao > > <zhichao....@intel.com> wrote: > > > > > > REF: > > https://bugzilla.tianocore.org/show_bug.cgi?id=1740 > > > > > > Add a 'static' descriptor to the global variables that > > only > > > used in a single file to minimize the name collisions. > > > This is only for the varable named > > 'mExitBootServicesEvent'. > > > > > > Cc: Laszlo Ersek <ler...@redhat.com> > > > Cc: Michael D Kinney <michael.d.kin...@intel.com> > > > Cc: Liming Gao <liming....@intel.com> > > > Cc: Dandan Bi <dandan...@intel.com> > > > Signed-off-by: Zhichao Gao <zhichao....@intel.com> > > > --- > > > > > MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c | > > 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git > > a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c > > b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c > > > index d4fdfbab55..bb7b144569 100644 > > > --- > > a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c > > > +++ > > b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c > > > @@ -15,9 +15,9 @@ > > > // > > > // BOOLEAN value to indicate if it is at the post > > ExitBootServices pahse > > > // > > > -BOOLEAN mPostEBS = FALSE; > > > +BOOLEAN mPostEBS = FALSE; > > > > > > -EFI_EVENT mExitBootServicesEvent; > > > +static EFI_EVENT mExitBootServicesEvent; > > > > > > > Please use STATIC not static. > > > > > > > // > > > // Pointer to SystemTable > > > -- > > > 2.21.0.windows.1 > > > > > > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39514): https://edk2.groups.io/g/devel/message/39514 Mute This Topic: https://groups.io/mt/31318888/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-