]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
fix detection of lzma_stream_encoder_mt with Werror (#1965)
authoralice <alice@ayaya.dev>
Fri, 22 Sep 2023 23:57:55 +0000 (01:57 +0200)
committerGitHub <noreply@github.com>
Fri, 22 Sep 2023 23:57:55 +0000 (01:57 +0200)
the function is marked as warn-unused-result, so by default in a Debug
build with cmake, when Werror is set, this fails to detect. do the same
for autotools.

CMakeLists.txt
configure.ac

index dc1fcc72a7fc21ec38ddd1a0085f0d04403ac44c..6211fd8ac17eb93ef22a7016b87346aac4413ea3 100644 (file)
@@ -523,7 +523,7 @@ IF(LIBLZMA_FOUND)
     "#include <lzma.h>\nint main() {return (int)lzma_version_number(); }"
     "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC")
   CHECK_C_SOURCE_COMPILES(
-    "#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
+    "#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){int ignored __attribute__((unused)); ignored = lzma_stream_encoder_mt(0, 0); return 0;}"
     HAVE_LZMA_STREAM_ENCODER_MT)
   IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
     ADD_DEFINITIONS(-DLZMA_API_STATIC)
index 67235c5d94fc269a3b1faac04dec851c896cb429..79a13b53d8725e12af604a383dead59c7b6282f0 100644 (file)
@@ -482,7 +482,7 @@ if test "x$with_lzma" != "xno"; then
                        [#if LZMA_VERSION < 50020000]
                        [#error unsupported]
                        [#endif]],
-                      [[lzma_stream_encoder_mt(0, 0);]])],
+                      [[int ignored __attribute__((unused)); ignored = lzma_stream_encoder_mt(0, 0);]])],
       [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])])
   if test "x$ac_cv_lzma_has_mt" != xno; then
          AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.])