[microtar] CMakeLists.txt: FIXME: Fix stringop-truncation warnings.

This broke the Ubuntu 22.04 AppVeyor build:

extlib/microtar/src/microtar.c: In function ‘mtar_read_header’:
extlib/microtar/src/microtar.c:111:3: error: ‘__builtin_strncpy’ output may be truncated copying 99 bytes from a string of length 99 [-Werror=stringop-truncation]
  111 |   strncpy(h->name, rh->name, sizeof(h->name));
      |   ^
extlib/microtar/src/microtar.c:112:3: error: ‘__builtin_strncpy’ output may be truncated copying 99 bytes from a string of length 99 [-Werror=stringop-truncation]
  112 |   strncpy(h->linkname, rh->linkname, sizeof(h->linkname));
      |   ^
cc1: all warnings being treated as errors
This commit is contained in:
David Korth 2025-04-06 19:41:58 -04:00
parent cc3a501ae6
commit b8ba2bee67
2 changed files with 6 additions and 1 deletions

View File

@ -274,7 +274,7 @@ IF(CFLAG_OPTIMIZE_FTREE_VECTORIZE)
ENDIF(CFLAG_OPTIMIZE_FTREE_VECTORIZE)
# Add "-Werror" *after* checking for everything else.
SET(RP_IGNORE_ERRORS "-Wno-error=unknown-pragmas -Wno-error=address-of-packed-member -Wno-error=address -Wno-error=attributes -Wno-error=unused-parameter -Wno-error=unused-but-set-variable -Wno-error=ignored-qualifiers -Wno-error=missing-field-initializers -Wno-error=unused-variable -Wno-error=unused-function -Wno-error=type-limits -Wno-error=empty-body -Wno-error=shift-negative-value -Wno-error=deprecated-declarations")
SET(RP_IGNORE_ERRORS "-Wno-error=unknown-pragmas -Wno-error=address-of-packed-member -Wno-error=address -Wno-error=attributes -Wno-error=unused-parameter -Wno-error=unused-but-set-variable -Wno-error=ignored-qualifiers -Wno-error=missing-field-initializers -Wno-error=unused-variable -Wno-error=unused-function -Wno-error=type-limits -Wno-error=empty-body -Wno-error=shift-negative-value")
SET(RP_C_FLAGS_COMMON "${RP_C_FLAGS_COMMON} -Werror ${RP_IGNORE_ERRORS}")
SET(RP_CXX_FLAGS_COMMON "${RP_CXX_FLAGS_COMMON} -Werror ${RP_IGNORE_ERRORS}")

View File

@ -1,6 +1,11 @@
# MicroTAR: Basic tar v7 library.
PROJECT(microtar LANGUAGES C)
# rom-properties: FIXME: Fix these warnings.
IF(NOT MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=stringop-truncation")
ENDIF(NOT MSVC)
ADD_LIBRARY(${PROJECT_NAME} STATIC src/microtar.c)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
DO_SPLIT_DEBUG(${PROJECT_NAME})