[edk2-devel] [Patch 1/2] MdePkg/Include/IndustryStandard: Address C++ keyword collisions

Michael D Kinney posted 2 patches 2 years, 8 months ago
There is a newer version of this series
[edk2-devel] [Patch 1/2] MdePkg/Include/IndustryStandard: Address C++ keyword collisions
Posted by Michael D Kinney 2 years, 8 months ago
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.

* Change operator -> Operator
* Change 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 | 4 ++--
 MdePkg/Include/IndustryStandard/Tpm20.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Tpm12.h b/MdePkg/Include/IndustryStandard/Tpm12.h
index 155dcc9f5f99..147c0863fffd 100644
--- a/MdePkg/Include/IndustryStandard/Tpm12.h
+++ b/MdePkg/Include/IndustryStandard/Tpm12.h
@@ -744,8 +744,8 @@ typedef struct tdTPM_PERMANENT_FLAGS {
   BOOLEAN              TPMpost;
   BOOLEAN              TPMpostLock;
   BOOLEAN              FIPS;
-  BOOLEAN                           operator;
-  BOOLEAN                           enableRevokeEK;
+  BOOLEAN              Operator;
+  BOOLEAN              enableRevokeEK;
   BOOLEAN              nvLocked;
   BOOLEAN              readSRKPub;
   BOOLEAN              tpmEstablished;
diff --git a/MdePkg/Include/IndustryStandard/Tpm20.h b/MdePkg/Include/IndustryStandard/Tpm20.h
index 4440f3769f26..c827af13efd0 100644
--- a/MdePkg/Include/IndustryStandard/Tpm20.h
+++ b/MdePkg/Include/IndustryStandard/Tpm20.h
@@ -1247,7 +1247,7 @@ typedef union {
   TPMI_AES_KEY_BITS    aes;
   TPMI_SM4_KEY_BITS    SM4;
   TPM_KEY_BITS         sym;
-  TPMI_ALG_HASH     xor;
+  TPMI_ALG_HASH        Xor;
 } TPMU_SYM_KEY_BITS;
 
 // Table 123 - TPMU_SYM_MODE Union
@@ -1320,7 +1320,7 @@ typedef struct {
 // Table 136 - TPMU_SCHEME_KEYEDHASH Union
 typedef union {
   TPMS_SCHEME_HMAC    hmac;
-  TPMS_SCHEME_XOR  xor;
+  TPMS_SCHEME_XOR     Xor;
 } TPMU_SCHEME_KEYEDHASH;
 
 // Table 137 - TPMT_KEYEDHASH_SCHEME Structure
-- 
2.40.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105393): https://edk2.groups.io/g/devel/message/105393
Mute This Topic: https://groups.io/mt/99204100/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch 1/2] MdePkg/Include/IndustryStandard: Address C++ keyword collisions
Posted by Yao, Jiewen 2 years, 8 months ago
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael D
> Kinney
> Sent: Tuesday, May 30, 2023 1:07 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>; Oliver Smith-Denny <osde@linux.microsoft.com>;
> Pedro Falcato <pedro.falcato@gmail.com>; Pop, Aaron
> <aaronpop@microsoft.com>
> Subject: [edk2-devel] [Patch 1/2] MdePkg/Include/IndustryStandard: Address
> C++ keyword collisions
> 
> 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.
> 
> * Change operator -> Operator
> * Change 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 | 4 ++--
>  MdePkg/Include/IndustryStandard/Tpm20.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/MdePkg/Include/IndustryStandard/Tpm12.h
> b/MdePkg/Include/IndustryStandard/Tpm12.h
> index 155dcc9f5f99..147c0863fffd 100644
> --- a/MdePkg/Include/IndustryStandard/Tpm12.h
> +++ b/MdePkg/Include/IndustryStandard/Tpm12.h
> @@ -744,8 +744,8 @@ typedef struct tdTPM_PERMANENT_FLAGS {
>    BOOLEAN              TPMpost;
>    BOOLEAN              TPMpostLock;
>    BOOLEAN              FIPS;
> -  BOOLEAN                           operator;
> -  BOOLEAN                           enableRevokeEK;
> +  BOOLEAN              Operator;
> +  BOOLEAN              enableRevokeEK;
>    BOOLEAN              nvLocked;
>    BOOLEAN              readSRKPub;
>    BOOLEAN              tpmEstablished;
> diff --git a/MdePkg/Include/IndustryStandard/Tpm20.h
> b/MdePkg/Include/IndustryStandard/Tpm20.h
> index 4440f3769f26..c827af13efd0 100644
> --- a/MdePkg/Include/IndustryStandard/Tpm20.h
> +++ b/MdePkg/Include/IndustryStandard/Tpm20.h
> @@ -1247,7 +1247,7 @@ typedef union {
>    TPMI_AES_KEY_BITS    aes;
>    TPMI_SM4_KEY_BITS    SM4;
>    TPM_KEY_BITS         sym;
> -  TPMI_ALG_HASH     xor;
> +  TPMI_ALG_HASH        Xor;
>  } TPMU_SYM_KEY_BITS;
> 
>  // Table 123 - TPMU_SYM_MODE Union
> @@ -1320,7 +1320,7 @@ typedef struct {
>  // Table 136 - TPMU_SCHEME_KEYEDHASH Union
>  typedef union {
>    TPMS_SCHEME_HMAC    hmac;
> -  TPMS_SCHEME_XOR  xor;
> +  TPMS_SCHEME_XOR     Xor;
>  } TPMU_SCHEME_KEYEDHASH;
> 
>  // Table 137 - TPMT_KEYEDHASH_SCHEME Structure
> --
> 2.40.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105403): https://edk2.groups.io/g/devel/message/105403
Mute This Topic: https://groups.io/mt/99204100/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-