tpm2: fix undefined behavior of macro expansion

Fix the preprocessor warning:

macro expansion producing 'defined' has undefined behavior

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2018-11-29 21:06:35 -05:00 committed by Stefan Berger
parent a433bf1217
commit 1bd13f5bb5

View File

@ -90,7 +90,16 @@ typedef struct sequenceMethods {
SMAC_DATA_METHOD data;
SMAC_END_METHOD end;
} SMAC_METHODS;
#define SMAC_IMPLEMENTED (defined TPM_CC_MAC || defined TPM_CC_MAC_Start)
#if 0 /* libtpms changed begin (undefined behavior of macro expansion) */
# define SMAC_IMPLEMENTED (defined TPM_CC_MAC || defined TPM_CC_MAC_Start)
#else
# if defined TPM_CC_MAC || defined TPM_CC_MAC_Start
# define SMAC_IMPLEMENTED 1
# else
# define SMAC_IMPLEMENTED 0
# endif
#endif /* libtpms changed end */
/* These definitions are here because the SMAC state is in the union of hash states. */