Leif,

How about using the following pragma instead if include guards?
        
        #pragma once

https://en.wikipedia.org/wiki/Pragma_once

This appears to be supports by GCC 3.4 and higher, clang, and VS.

Might even speed up builds a bit.

Mike

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Monday, April 15, 2019 8:53 AM
> To: Leif Lindholm <leif.lindh...@linaro.org>; Wu, Hao A
> <hao.a...@intel.com>; Kinney, Michael D
> <michael.d.kin...@intel.com>
> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>;
> devel@edk2.groups.io; Andrew Fish <af...@apple.com>;
> Zeng, Star <star.z...@intel.com>; Dong, Eric
> <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Gao,
> Liming <liming....@intel.com>; Carsey, Jaben
> <jaben.car...@intel.com>; Shi, Steven
> <steven....@intel.com>; Wang, Jian J
> <jian.j.w...@intel.com>
> Subject: RE: [PATCH v6 1/7] MdeModulePkg: introduce
> PE/COFF image emulator protocol
> 
> Hi Leif,
> 
> This is not a macro that is to be used by C code.  It
> is a technique
> to prevent recursive includes on a .h file.  As a
> result, we do not want
> to use the C Coding Standard macro style.
> 
> Are there other techniques to prevent recursive
> includes?
> 
> I agree that macros/symbols that start with single or
> double '_'
> are reserved by compilers/linkers, which is why the
> warning is
> triggered and it would be better if we use a different
> technique.
> 
> The current style assumes that the define symbol used
> will not
> collide with a compiler/linker symbol.  The names are
> verbose,
> so the chances of a collision are very low.
> 
> Mike
> 
> > -----Original Message-----
> > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > Sent: Monday, April 15, 2019 2:02 AM
> > To: Wu, Hao A <hao.a...@intel.com>
> > Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>;
> > devel@edk2.groups.io; Kinney, Michael D
> > <michael.d.kin...@intel.com>; Andrew Fish
> > <af...@apple.com>; Zeng, Star <star.z...@intel.com>;
> > Dong, Eric <eric.d...@intel.com>; Ni, Ray
> > <ray...@intel.com>; Gao, Liming
> <liming....@intel.com>;
> > Carsey, Jaben <jaben.car...@intel.com>; Shi, Steven
> > <steven....@intel.com>; Wang, Jian J
> > <jian.j.w...@intel.com>
> > Subject: Re: [PATCH v6 1/7] MdeModulePkg: introduce
> > PE/COFF image emulator protocol
> >
> > On Mon, Apr 15, 2019 at 01:23:11AM +0000, Wu, Hao A
> > wrote:
> > > > +  This program and the accompanying materials
> are
> > licensed and made
> > > > available
> > > > +  under the terms and conditions of the BSD
> > License which accompanies this
> > > > +  distribution.  The full text of the license
> may
> > be found at
> > > > +  http://opensource.org/licenses/bsd-license.php
> > > > +
> > > > +  THE PROGRAM IS DISTRIBUTED UNDER THE BSD
> LICENSE
> > ON AN "AS IS"
> > > > BASIS,
> > > > +  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
> > KIND, EITHER
> > > > EXPRESS OR IMPLIED.
> > > > +
> > > > +**/
> > > > +
> > > > +#ifndef PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
> > > > +#define PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
> > >
> > > Hello Ard,
> > >
> > > Sorry for the delayed response.
> > >
> > > Could you help to use:
> > > _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
> > >
> > > here to please the Ecc checker when you push the
> > series?
> >
> > Hmm...
> >
> > Not a major issue, but I'll mention it anyway (which
> I
> > mentioned to
> > Andrew/Mike at Linaro Connect in Vancouver last
> year):
> > clang has a warning, enabled by -Wreserved-id-macro,
> > which complains
> > about this.
> >
> > The Coding Style matches this, suggesting
> > MACROS_SHOULD_BE_WRITTEN_THUS_. So do we need to fix
> > Ecc?
> >
> > Regards,
> >
> > Leif

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39125): https://edk2.groups.io/g/devel/message/39125
Mute This Topic: https://groups.io/mt/31133140/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to