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 <[email protected]>; Wu, Hao A
> <[email protected]>; Kinney, Michael D
> <[email protected]>
> Cc: Ard Biesheuvel <[email protected]>;
> [email protected]; Andrew Fish <[email protected]>;
> Zeng, Star <[email protected]>; Dong, Eric
> <[email protected]>; Ni, Ray <[email protected]>; Gao,
> Liming <[email protected]>; Carsey, Jaben
> <[email protected]>; Shi, Steven
> <[email protected]>; Wang, Jian J
> <[email protected]>
> 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:[email protected]]
> > Sent: Monday, April 15, 2019 2:02 AM
> > To: Wu, Hao A <[email protected]>
> > Cc: Ard Biesheuvel <[email protected]>;
> > [email protected]; Kinney, Michael D
> > <[email protected]>; Andrew Fish
> > <[email protected]>; Zeng, Star <[email protected]>;
> > Dong, Eric <[email protected]>; Ni, Ray
> > <[email protected]>; Gao, Liming
> <[email protected]>;
> > Carsey, Jaben <[email protected]>; Shi, Steven
> > <[email protected]>; Wang, Jian J
> > <[email protected]>
> > 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: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-