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.web10.2491.1685472809773224682 for ; Tue, 30 May 2023 11:53:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CIh4IITN; 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=1685472810; x=1717008810; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LDqjdFVEmK8ZWrrSth/VTYN1iQBa1X6rs+w+qeuOkQY=; b=CIh4IITNzVcESXssGThI2b/kFHjB971t/g0YJDLvgIIxH59s+te6pDnt zegDyOqU6j0GGRiOrmUCt4WGEhMBfdn/8vLnLyFevH3JVnLhzgO85S0f9 qlLseCcSNQvKH5Q/n073T1xI+gkFnbl9wtk2XGXox7ziDiYB/SldCJg2/ IHZlsnBA7YrnqF7q2IlFaJb2g3rhLwht1P7xxDvhf/FfUiKoLauofYCIH jrGg7jOxjGK90cpVy/uDvJkPb8frtDSqp02We55aSwWM3lrkvG+Oxo7mW 8O7w4FVdOQSsEPUgKq0F+DB8T+Ci+QZ4RYiZ/pckHzxWNf5FbKqy7B3Wl Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="352514934" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="352514934" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 11:53:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="771675340" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="771675340" Received: from unknown (HELO mdkinney-mobl.amr.corp.intel.com) ([10.241.111.19]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 11:53:30 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Oliver Smith-Denny , Pedro Falcato , Aaron Pop Subject: [Patch v2 3/3] MdePkg/Include/IndustryStandard: Address C++ keyword collisions Date: Tue, 30 May 2023 11:53:22 -0700 Message-Id: <20230530185322.70-4-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.40.1.windows.1 In-Reply-To: <20230530185322.70-1-michael.d.kinney@intel.com> References: <20230530185322.70-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Update Tpm12.h and Tpm20.h and not use c++ reserved keywords operator and xor in C structures to support use of these include files when building with a C++ compiler. This patch removes the temporary use of anonymous unions and warning 4201 disable for VS20xx tool chains to complete the following field name changes: * operator -> Operator * xor -> Xor NOTE: This is a non-backwards compatible change to Tpm12.h and Tmp20.h. And consumers of these include files that access the "operator" or "xor" fields must be updated. Cc: Liming Gao Cc: Zhiguang Liu Cc: Oliver Smith-Denny Cc: Pedro Falcato Cc: Aaron Pop Signed-off-by: Michael D Kinney --- MdePkg/Include/IndustryStandard/Tpm12.h | 20 +------------------- MdePkg/Include/IndustryStandard/Tpm20.h | 25 ++----------------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/MdePkg/Include/IndustryStandard/Tpm12.h b/MdePkg/Include/IndustryStandard/Tpm12.h index 56e89d9d0835..147c0863fffd 100644 --- a/MdePkg/Include/IndustryStandard/Tpm12.h +++ b/MdePkg/Include/IndustryStandard/Tpm12.h @@ -9,14 +9,6 @@ #ifndef _TPM12_H_ #define _TPM12_H_ -/// -/// Temporary disable 4201 to support anonymous unions -/// -#if defined (_MSC_EXTENSIONS) -#pragma warning( push ) -#pragma warning ( disable : 4201 ) -#endif - /// /// The start of TPM return codes /// @@ -752,10 +744,7 @@ typedef struct tdTPM_PERMANENT_FLAGS { BOOLEAN TPMpost; BOOLEAN TPMpostLock; BOOLEAN FIPS; - union { - BOOLEAN operator; - BOOLEAN Operator; - }; + BOOLEAN Operator; BOOLEAN enableRevokeEK; BOOLEAN nvLocked; BOOLEAN readSRKPub; @@ -2173,11 +2162,4 @@ typedef struct tdTPM_RSP_COMMAND_HDR { #pragma pack () -/// -/// Temporary disable 4201 to support anonymous unions -/// -#if defined (_MSC_EXTENSIONS) -#pragma warning( pop ) -#endif - #endif diff --git a/MdePkg/Include/IndustryStandard/Tpm20.h b/MdePkg/Include/IndustryStandard/Tpm20.h index a602c0d9c289..c827af13efd0 100644 --- a/MdePkg/Include/IndustryStandard/Tpm20.h +++ b/MdePkg/Include/IndustryStandard/Tpm20.h @@ -15,14 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include -/// -/// Temporary disable 4201 to support anonymous unions -/// -#if defined (_MSC_EXTENSIONS) -#pragma warning( push ) -#pragma warning ( disable : 4201 ) -#endif - #pragma pack (1) // Annex A Algorithm Constants @@ -1255,10 +1247,7 @@ typedef union { TPMI_AES_KEY_BITS aes; TPMI_SM4_KEY_BITS SM4; TPM_KEY_BITS sym; - union { - TPMI_ALG_HASH xor; - TPMI_ALG_HASH Xor; - }; + TPMI_ALG_HASH Xor; } TPMU_SYM_KEY_BITS; // Table 123 - TPMU_SYM_MODE Union @@ -1331,10 +1320,7 @@ typedef struct { // Table 136 - TPMU_SCHEME_KEYEDHASH Union typedef union { TPMS_SCHEME_HMAC hmac; - union { - TPMS_SCHEME_XOR xor; - TPMS_SCHEME_XOR Xor; - }; + TPMS_SCHEME_XOR Xor; } TPMU_SCHEME_KEYEDHASH; // Table 137 - TPMT_KEYEDHASH_SCHEME Structure @@ -1823,11 +1809,4 @@ typedef struct { #define HASH_ALG_SHA512 0x00000008 #define HASH_ALG_SM3_256 0x00000010 -/// -/// Temporary disable 4201 to support anonymous unions -/// -#if defined (_MSC_EXTENSIONS) -#pragma warning( pop ) -#endif - #endif -- 2.40.1.windows.1