[patch #9750] ax_pthread: Avoid a -Wunused-variable warning on PTHREAD_PRIO_INHERIT

Vincent Lefèvre <[email protected]> Sun, 27 Jan 2019 17:16:07 -0500 (EST)
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/patch/?9750>

                 Summary: ax_pthread: Avoid a -Wunused-variable warning on
PTHREAD_PRIO_INHERIT
                 Project: GNU Autoconf Archive
            Submitted by: vinc17
            Submitted on: dim. 27 janv. 2019 22:16:06 UTC
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: dim. 27 janv. 2019 22:16:06 UTC  Name: ax_pthread-prio.patch  Size: 779o
  By: vinc17
Patch fixing the PTHREAD_PRIO_INHERIT check in ax_pthread
<http://savannah.gnu.org/patch/download.php?file_id=46110>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9750>

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/