Skip to content

Commit

Permalink
libtcgtpm: set -Wno-error=unused-variable in TPM CFLAGS
Browse files Browse the repository at this point in the history
The next commit switches to TCG TPM, but there is a problem when the
`FILE_BACKED_NV` macro is set to `NO`. It produces the following compile
error because a variable is not used:

    Platform/src/NVMem.c: In function ‘_plat__NVDisable’:
    Platform/src/NVMem.c:185:9: error: unused variable ‘delete’ [-Werror=unused-variable]
      185 |     int delete = ((intptr_t)platParameter != 0)
          |         ^~~~~~
    cc1: all warnings being treated as errors
    make[2]: *** [Makefile:2674: Platform/src/libplatform_a-NVMem.o] Error 1

This commit can be reverted when the following PR will be merged:
TrustedComputingGroup/TPM#7

Signed-off-by: Stefano Garzarella <[email protected]>
  • Loading branch information
stefano-garzarella committed Nov 12, 2024
1 parent 708beea commit b3566f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libtcgtpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ TCGTPM_CFLAGS += -static -nostdinc -fno-stack-protector -fPIE -mno-sse -mno-red-
TCGTPM_CFLAGS += -DSIMULATION=NO -DFILE_BACKED_NV=NO
TCGTPM_CFLAGS += -I$(LIBCRT_DIR)/include
TCGTPM_CFLAGS += -I$(OPENSSL_DIR)/include
# This is needed to workaround an issue with an unused variable when
# FILE_BACKED_NV is set to NO. The real fix is posted here:
# https://github.com/TrustedComputingGroup/TPM/pull/7
# When that PR is merged, we can remove this line.
TCGTPM_CFLAGS += -Wno-error=unused-variable

# Configure the TPM 2.0 Reference Implementation and remove the pthread requirement.
# In fact, pthread is required only in the TPM simulator, but we
Expand Down

0 comments on commit b3566f4

Please sign in to comment.