[edk2-devel] GoogleTest Compatibility with MdePkg's IndustyStandard header files

Michael D Kinney michael.d.kinney at intel.com
Thu May 25 00:23:59 UTC 2023


That is exactly what I did.  Along with pragma to disable error on macros redefining operators.

With that change use of "operator" did not generate a warning or error and the build completed.

Did not work for "xor", and can not find any additional pragma to suppress that error.

Mike

> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Pedro
> Falcato
> Sent: Wednesday, May 24, 2023 2:55 PM
> To: devel at edk2.groups.io; Kinney, Michael D <michael.d.kinney at intel.com>
> Cc: Pop, Aaron <aaronpop at microsoft.com>
> Subject: Re: [edk2-devel] GoogleTest Compatibility with MdePkg's
> IndustyStandard header files
> 
> On Wed, May 24, 2023 at 10:23 PM Michael D Kinney
> <michael.d.kinney at intel.com> wrote:
> >
> > After trying a few GCC experiments, there does not appear to be any way
> to work around “xor” keyword.
> >
> >
> >
> > I recommend we update EDK II sources to not use c++ keywords to avoid
> this issue all together.
> >
> >
> >
> > This may require changes that do not match names from industry standard
> specs.
> 
> This is a crappy problem but it's workaroundable in the header by
> using something like:
> 
> #ifdef __cplusplus
> #define SOME_MEMBER_NAME alternative_name
> #else
> #define SOME_MEMBER_NAME bad_name
> #endif
> 
> and then in the struct...
> 
> struct Foo
> {
>     UINTN SOME_MEMBER_NAME;
> };
> 
> 
> It should work around these C++ issues while keeping compat with existing
> code.
> Although yes, avoiding C++ keywords is a good idea, particularly if
> you're planning to bring more C++ into edk2.
> 
> --
> Pedro
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105287): https://edk2.groups.io/g/devel/message/105287
Mute This Topic: https://groups.io/mt/99079638/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list