From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.3830.1684957782029257253 for ; Wed, 24 May 2023 12:49:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=IvaHW6Ms; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684957782; x=1716493782; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=vOvo73U3SUIAbWyFTjQtrO88935PAlbUcJS/CvTonqs=; b=IvaHW6MsU5JdHnIJrfu1BZwcg8PA7o/wXtbcDuKGWfY5+YGPBpaygvlr pSbY3dyF1iN5qEkKHIIl6YCbceaA/JTVO7o/FgoMkvbMb5s5X5H2oASXO xzTXhTiqRbdkG0dI2x0sQJJB9qtOGzDqDCiVoMQ0ekdsuhOJ7dk6Xv9JE 4nKmHaHhcL3jZzsgmXTMqVkTDIgi1Fxr2D5zTvZqfquKiDUaYg8zAQ4n2 Vp+wpW9XvODVN9kDhfL8IORoqPPr8S2fLL7PhZSHwGoEqu/yKqv19T/id f1wnp9ZotdFcBeYeL/oPOgza1imHvhYFevvdvKsJOHzKd0nZf295l2Z+M w==; X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="351186938" X-IronPort-AV: E=Sophos;i="6.00,190,1681196400"; d="scan'208,217";a="351186938" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2023 12:49:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="878801071" X-IronPort-AV: E=Sophos;i="6.00,190,1681196400"; d="scan'208,217";a="878801071" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga005.jf.intel.com with ESMTP; 24 May 2023 12:49:10 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 24 May 2023 12:49:10 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 24 May 2023 12:49:10 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 24 May 2023 12:49:10 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 24 May 2023 12:49:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gwtiJrobCtGSHUQpDK6hFyuFyc6eoDuBWuQ///n/unpD+pXBIeOJYjPbRttiYGPe+7nbK/3ZnFwahAJO02iyOgIChizV9iTWICRnavbu3BO6lsw17Hb41Lqh99+mKvYa/W5ZSemr19WGONWD+VZAARTo54uIdW9A4gvh56IrR32b6KS+rDki/U41F6vB+bRdkLzC0Wxhd/HaQ9LqnEl+DhLGqw0NHoIneCO9R1F/+94YV3PogP0zmzOMXVWw59wK+MKRlsc0kMruWYGE7XSBG3QXDcmSTR3I+JVTK0ddcyucDGu3mB+2UgnBl8hkiBYlXnOqqblLYXOrDhpk/gpASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ahxJh9CLyR2JSto8+Ebq3hocfszyZZQ4ozafrLj8gWU=; b=CefPbC9/tL6Edza0JzZKd+7WhGNMEsffTO8khsXm/wCFgAwq8nm7cJS+UWJgxu0dnunLJFWmZcO6G1K9eLT6NhlFqhf2+EvzBP7pzidW0mrpL6kv+WxljTH91bg7NlOr0pdQEv1floBMcEsQFaUvWal4jBUSgBYKYQ0Dlo8jdvFg+kDGcZ3UBGjnjX7u3KUIiIFjYhVDIGMC+7wkaeBVfOYxjg0gKM6DNHWA4iyuN7/WBP/0nqYO1uEb62EVx9hBCM4vU/LqfOBObSyEaT0JAGKxm1v4w5s/EKrYlALSECUUnb6XExNsffcYku2H/ekFOARtN8LvBfUQNmTDWEIeAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by PH7PR11MB7605.namprd11.prod.outlook.com (2603:10b6:510:277::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Wed, 24 May 2023 19:49:03 +0000 Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::4752:67f2:9956:b277]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::4752:67f2:9956:b277%4]) with mapi id 15.20.6411.029; Wed, 24 May 2023 19:49:03 +0000 From: "Michael D Kinney" To: "Pop, Aaron" , "devel@edk2.groups.io" CC: "Kinney, Michael D" Subject: Re: GoogleTest Compatibility with MdePkg's IndustyStandard header files Thread-Topic: GoogleTest Compatibility with MdePkg's IndustyStandard header files Thread-Index: AdmNCFzONb90exfORZ2x+UzGvNjL+wBauAkQ Date: Wed, 24 May 2023 19:49:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=6ca6b3d0-a1a7-4645-a98a-43f873bd8465;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-05-22T23:40:24Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|PH7PR11MB7605:EE_ x-ms-office365-filtering-correlation-id: eddc8bcf-963c-4941-e955-08db5c8fed0e x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: whGloyJC4qO7ZS9L5iFkZcgkIPR4ilEcD6CvJsEqglU6SnqDiMFt3YbHA1aCNQGNp74bHQDvvUuxksrJFAhKwk9o9u8UmL5GQvGrK6fIvcPWohAE0U7URRZJPlhMx3ziND5e9o8Hb1TpH/Y6NPgDX0m2Zkoc3yuiQIA7yb7z9xkQEYBZocwrnmL+Lr3DfBgbdbCWmLL4GXj1l/Pb9rDQnxBpPS55I9Ri4J7xlYgZAl5yrcBwfogLFIywU0L9tAkBpMgvyI3swu8YxiNrYFH8VhoccAU7FQLQApEYp50sukcxVYmB7g3mDU2zmoqtx5GfQzLXKjH3dJdqlaK1WYs7HJ5LER+XUWZQo7pKF2Rk3HR2RCXOL3QtZeXxciFRvwHqew2xEPwlExzJEBM1EZOZebmA0rOILUKx6gMzAV7UoLlR6P98XSR3VOuUonA2y4Qw2RARP372GboROKRmjxqaOZK+MOgyCenKEuh50+NRZtSo9hiYMrhdeYFnerkcm1WWcAGayTG2Re+mcSkHjAlTG5SsZbKDIM1iwSAqG3J6vtRfD0U5JFZxQwP73rd+UmgNx2hkGZ9NE0qOfGG0lQjWuyjTp4EQSElNVpkHllVH6zLzx91u5IaRn3495G9tWXvn x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4929.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(366004)(346002)(136003)(396003)(376002)(451199021)(2906002)(110136005)(5660300002)(52536014)(9326002)(8676002)(8936002)(76116006)(41300700001)(478600001)(66946007)(64756008)(66476007)(66556008)(66446008)(4326008)(7696005)(33656002)(316002)(71200400001)(45080400002)(55016003)(26005)(9686003)(122000001)(53546011)(6506007)(38100700002)(86362001)(107886003)(186003)(38070700005)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?eK1NlyWY+NorCAzmgaSgQ3lPvUFGISlYWwNLQoBlvfK9eO8fq8JeFiAPRFcs?= =?us-ascii?Q?zhM2a4lURQkMxuH+cbQkHZ/CgndPxKyKUmhQKGG6j6NaZP6aoZv0GMLCz1Gl?= =?us-ascii?Q?iYRQV7jnXdVJkb3kCz4NO05OmGmo+YSfpW8fVKi42l7gO0tRgSOQIzsTv20L?= =?us-ascii?Q?ACk6FCR44yjptoLK5UdHRhiKHCQLu5MfUNpcW3fFzglyRYrGKhlCq4OqaOak?= =?us-ascii?Q?vHMM7+XLDc5IHSTKNcbePuUdcKspgAGrCXj0m1CLBkX9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5XIvynHNCcc91ZZU4di5Q6mgEpLTMAsmy3JO8lVc9IMukybisV4DA?= =?us-ascii?Q?6XCaev//XeyD7BbYg7+5HrWv1ehbeApp3nELZid2xj33XYIfv/svX2F2l9dL?= =?us-ascii?Q?j3pwDVmYNPLfhGLLB4GN3ItfeKUdZaN/R4MKalE8CYLUW7omYMAbCCXNI0VW?= =?us-ascii?Q?IUkI3wzrNaOPsvXz9PEcTDbRqFv7tOVoslebCNHAlttptM0jclrHxBY/9tfn?= =?us-ascii?Q?XLf3JnUGZINh+Tb+K1LZI6XBmFzREZ13DKNDEuTm4JVNxVzNDJRy2BsUlA9s?= =?us-ascii?Q?N7I0pvah/UjS9FBMC6OZOtIuraKNgwc4mckq/nu5VNGs/rrhn+EnniA5M2My?= =?us-ascii?Q?GiPnHrzGz6G78dSNdcl+hjAVlrEsAlys0TVeFuFFYAfEf+SY0guNopqHFaC6?= =?us-ascii?Q?xdxKufSDh0rp9j2Jkygy+OVe0ONeXQRcgtfRqvKFtHmVW/mNFL2N+NJ6qHoM?= =?us-ascii?Q?4A=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eddc8bcf-963c-4941-e955-08db5c8fed0e X-MS-Exchange-CrossTenant-originalarrivaltime: 24 May 2023 19:49:02.9991 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: F/rmgYC65mWNsKGe4x6c38ycUqjbHVGLZxykyuKUV8e7OTmskMLXdLbcTLcH3DXXXy0BTvyFNrBjoZ0nGbYj3ZJZTsrdrMesvM4iSNZyUIw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7605 Return-Path: michael.d.kinney@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB49299486BF651E9790AFDE34D2419CO1PR11MB4929namp_" --_000_CO1PR11MB49299486BF651E9790AFDE34D2419CO1PR11MB4929namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Aaron, Don't know if this will completely resolve your issues, but if you add some= preprocessor statements around the problematic includes in your unit test = CPP file, you may be able to get it to build. For example, I added the highlighted lines to MdePkg\Test\GoogleTest\Librar= y\BaseSafeIntLib\TestBaseSafeIntLib.cpp and I can get that unit test to bui= ld. Without the #define/#undef lines it fails in the way you describe. #include extern "C" { #include #include #define operator operator_ #define xor xor_ #include #include #undef operator #undef xor } Mike From: Aaron Pop Sent: Monday, May 22, 2023 5:41 PM To: devel@edk2.groups.io Cc: Kinney, Michael D Subject: GoogleTest Compatibility with MdePkg's IndustyStandard header file= s Google Test, and CPP, has more keywords C uses. Tpm12.h and Tpm20.h have references to struct names that are `operator` and `xor`, both of whic= h trigger build errors because they conflict with CPP's keywords. Operator triggered a build error in MSVC. Xor only triggered a build error = under GCC, MSVC did not have a problem with it. The work arounds suggested in the call, (using defines to get around the co= nflict) worked for operator, but did not work for xor with gcc. Tpm12.h: TPM_PERMANENT_FLAGS BOOLEAN operator; Tpm20.h: TPMU_SCHEME_KEYEDHASH TPMS_SCHEME_XOR xor; TPMU_SYM_KEY_BITS TPMI_ALG_HASH xor; What is the suggested method of trying to make existing header files compat= ible with google test? Thanks, Aaron --_000_CO1PR11MB49299486BF651E9790AFDE34D2419CO1PR11MB4929namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Aaron,

 

Don’t know if this will completely resolve you= r issues, but if you add some preprocessor statements around the problemati= c includes in your unit test CPP file, you may be able to get it to build.<= o:p>

 

For example, I added the highlighted lines to MdePkg= \Test\GoogleTest\Library\BaseSafeIntLib\TestBaseSafeIntLib.cpp and I can ge= t that unit test to build.  Without the #define/#undef lines it fails = in the way you describe.

 

#include <gtest/gtest.h>

extern "C" {

  #include <Base.h>

  #include <Library/SafeIntLib.h>

 

#define operator operator_

#define xor xor_

 

  #include <IndustryStandard/Tpm20.h><= /p>

  #include <IndustryStandard/Tpm12.h>

 

#undef operator

#undef xor

}

 

Mike

 

 

From: Aaron Pop <aaronpop@microsoft.com&= gt;
Sent: Monday, May 22, 2023 5:41 PM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Subject: GoogleTest Compatibility with MdePkg's IndustyStandard head= er files

 

Google Test, and CPP, has more keywords  C uses= .

 

Tpm12.h and Tpm20.h

have references to struct names that are `operator` = and `xor`, both of which trigger build errors because they conflict with CP= P’s keywords.

 

Operator triggered a build error in MSVC. Xor only t= riggered a build error under GCC, MSVC did not have a problem with it.

 

The work arounds suggested in the call, (using defin= es to get around the conflict) worked for operator, but did not work for xo= r with gcc. 

 

 

Tpm12.h:

TPM_PERMANENT_FLAGS

  BOOLEAN      &n= bsp;            = ;        operator;

 

 

Tpm20.h:

TPMU_SCHEME_KEYEDHASH

  TPMS_SCHEME_XO= R  xor;

TPMU_SYM_KEY_BITS

  TPMI_ALG_HASH     xor;

 

 

What is the suggested method of trying to make exist= ing header files compatible with google test?

 

Thanks,

Aaron

--_000_CO1PR11MB49299486BF651E9790AFDE34D2419CO1PR11MB4929namp_--