From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Yu5JCV9v; spf=pass (domain: linaro.org, ip: 209.85.166.181, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-it1-f181.google.com (mail-it1-f181.google.com [209.85.166.181]) by groups.io with SMTP; Wed, 24 Apr 2019 10:09:49 -0700 Received: by mail-it1-f181.google.com with SMTP id y10so7490394itc.1 for ; Wed, 24 Apr 2019 10:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eexim2bOxKhP1J2APMe9Gbr90aOk2vQQDOat1QY257c=; b=Yu5JCV9v76rBQemHOnH1sXdpQdhdJ8xlbC5Vi7LOxceLpo34GuUillqrzi+7AzpQMZ IQJtyEwKATCGzjLUELLHac9ULf6sNXQbYVTHvBbjNFelcwFY3z2T0rOzjWU7d18kNVm0 773Q27cryO8XhtUV60nfeDb6sOtaSER6Faj8iFI2TsHHVRgTxZ5sKPPl2WM12+JG4/4M QdeODGZcZa1/bLkFagtc7HUZrSPDfpdPCWt6c0Ut10SLLiPcaJjByAyrudW79+clXSrv yBFDz8QNx1wr8i1wBz7kB7+AvyKcS4ALPEa3mf4KnHvbMb2dZxGEA8YFGxmJgqRLOxjb +uVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eexim2bOxKhP1J2APMe9Gbr90aOk2vQQDOat1QY257c=; b=Odbe+QyyMB4FTk5FSg9CUw4DBoNMow2xpmas8ErcSKrUm0DVo7jI4qxaEBvCdcMwUY JAoIWnXv8fc8xGjfoPTsIKux+0FvHphcyO1eFGXCrCdAriLaGPl+DW17+w2/bsqmAqg6 F3BcfZbD9hpAq6hKpGQyCYVGVXm8hlybuDl2nrzJMilNqyl60pGUV2MqQcoIt+NaHU3g 6S5+IhrUEguUIDd0L4ObiZUhiUEXMj4Cd7Mflel4GC6o953ST2OIrxzVaUxhFza803Q9 WlP+r5ohN/eZUCbnRDWgWd/0KV8KeCbgjfezK642YtpR2Nxp/HXRKv9dM+xmKrGQNayK lsXQ== X-Gm-Message-State: APjAAAXbfD6gPcv5OaC3AIsAm/jt5fLhtHqQbO9KhI30DII19CgcCps3 QZ8+JR4cNn+0rfH/qinaGkYoZEVAtkY/oqA053AEeA== X-Google-Smtp-Source: APXvYqy6vbV9BjhzoQjaCcMddl0OY7Hu6g+FgK/fMBMlf7ocS9/LRD4sjgyCvEYQ1RU0rvwi7xkQS8Z9bScfouH+in0= X-Received: by 2002:a02:1dc7:: with SMTP id 190mr7326931jaj.62.1556125788855; Wed, 24 Apr 2019 10:09:48 -0700 (PDT) MIME-Version: 1.0 References: <20190424045827.19348-1-zhichao.gao@intel.com> <20190424045827.19348-4-zhichao.gao@intel.com> In-Reply-To: From: "Ard Biesheuvel" Date: Wed, 24 Apr 2019 19:09:37 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH V2 3/8] MdePkg/UefiDebugLibStdErr: Decrease the name collisions To: "Kinney, Michael D" Cc: "devel@edk2.groups.io" , "Gao, Zhichao" , Laszlo Ersek , "Gao, Liming" , "Bi, Dandan" Content-Type: text/plain; charset="UTF-8" On Wed, 24 Apr 2019 at 18:59, Kinney, Michael D 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 ; Gao, > > Zhichao > > Cc: Laszlo Ersek ; Kinney, Michael D > > ; Gao, Liming > > ; Bi, Dandan > > Subject: Re: [edk2-devel] [PATCH V2 3/8] > > MdePkg/UefiDebugLibStdErr: Decrease the name collisions > > > > On Wed, 24 Apr 2019 at 06:59, Gao, Zhichao > > 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 > > > Cc: Michael D Kinney > > > Cc: Liming Gao > > > Cc: Dandan Bi > > > Signed-off-by: Zhichao Gao > > > --- > > > > > 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 > > > > > > > > > > > > > > > > >