Package: autoconf-archive
Version: 20180313-1
Severity: normal
Tags: patch upstream
Forwarded: https://savannah.gnu.org/patch/index.php?9750

The PTHREAD_PRIO_INHERIT check can trigger a -Wunused-variable warning,
which can be turned into an error when -Werror is used, with the
consequence that PTHREAD_PRIO_INHERIT appears to be missing:

configure:14787: checking for PTHREAD_PRIO_INHERIT
configure:14803: gcc -o conftest -O2 -Wall -Wold-style-declaration 
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes 
-Wmissing-declarations -Wmissing-field-initializers -Wc++-compat 
-Wno-error=unused-function -Werror -Wcast-function-type -Wcast-align=strict 
-pthread   conftest.c   >&5
conftest.c: In function 'main':
conftest.c:28:5: error: unused variable 'i' [-Werror=unused-variable]
 int i = PTHREAD_PRIO_INHERIT;
     ^
cc1: all warnings being treated as errors
configure:14803: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "MPFR"
| #define PACKAGE_TARNAME "mpfr"
| #define PACKAGE_VERSION "4.1.0-dev"
| #define PACKAGE_STRING "MPFR 4.1.0-dev"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define MPFR_WANT_SHARED_CACHE 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1
| #define HAVE_LITTLE_ENDIAN 1
| #define TIME_WITH_SYS_TIME 1
| /* end confdefs.h.  */
| #include <pthread.h>
| int
| main (void)
| {
| int i = PTHREAD_PRIO_INHERIT;
|   ;
|   return 0;
| }
configure:14812: result: no

This issue can easily be avoided by adding a "return i;". See attached
patch.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages autoconf-archive depends on:
ii  dpkg  1.19.4

Versions of packages autoconf-archive recommends:
ii  autoconf  2.69-11+local2

autoconf-archive suggests no packages.

-- no debconf information
Description: Avoid a -Wunused-variable warning on PTHREAD_PRIO_INHERIT.
Author: Vincent Lefevre <[email protected]>

--- ax_pthread.m4~      2019-01-04 19:01:05.000000000 +0100
+++ ax_pthread.m4       2019-01-27 22:17:03.654823777 +0100
@@ -438,7 +438,8 @@
         AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
             [ax_cv_PTHREAD_PRIO_INHERIT],
             [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
-                                             [[int i = 
PTHREAD_PRIO_INHERIT;]])],
+                                             [[int i = PTHREAD_PRIO_INHERIT;
+                                               return i;]])],
                             [ax_cv_PTHREAD_PRIO_INHERIT=yes],
                             [ax_cv_PTHREAD_PRIO_INHERIT=no])
             ])

Reply via email to