From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>,
Oliver Smith-Denny <osde@linux.microsoft.com>,
Pedro Falcato <pedro.falcato@gmail.com>,
Aaron Pop <aaronpop@microsoft.com>
Subject: [Patch v2 3/3] MdePkg/Include/IndustryStandard: Address C++ keyword collisions
Date: Tue, 30 May 2023 11:53:22 -0700 [thread overview]
Message-ID: <20230530185322.70-4-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20230530185322.70-1-michael.d.kinney@intel.com>
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 <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Oliver Smith-Denny <osde@linux.microsoft.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Aaron Pop <aaronpop@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
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 <IndustryStandard/Tpm12.h>
-///
-/// 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
next prev parent reply other threads:[~2023-05-30 18:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 18:53 [Patch v2 0/3] Address C++ keyword collisions Michael D Kinney
2023-05-30 18:53 ` [Patch v2 1/3] MdePkg/Include/IndustryStandard: Add Operator and Xor field names Michael D Kinney
2023-05-31 18:17 ` Pedro Falcato
2023-05-31 18:41 ` Michael D Kinney
2023-06-01 15:01 ` Michael D Kinney
2023-06-06 17:56 ` Michael D Kinney
2023-06-06 21:01 ` [edk2-devel] " Pedro Falcato
2024-02-27 23:46 ` Michael D Kinney
2024-02-27 23:55 ` Pedro Falcato
2024-02-28 0:33 ` Michael D Kinney
2023-05-30 18:53 ` [Patch v2 2/3] SecurityPkg/Library/TpmCommandLib: Change xor to Xor Michael D Kinney
2023-05-31 2:38 ` [edk2-devel] [PATCH] ShellPkg\SmbiosView: SmBiosView does not print correct Slot ID information asperber
2023-05-30 18:53 ` Michael D Kinney [this message]
2023-05-31 0:05 ` [edk2-devel] [Patch v2 0/3] Address C++ keyword collisions Yao, Jiewen
2023-05-31 17:46 ` Oliver Smith-Denny
2023-06-01 7:30 ` 回复: [edk2-devel] " gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230530185322.70-4-michael.d.kinney@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox