bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Test for pthread_rwlock_init() always passes, regardless


From: Sevan Janiyan
Subject: Test for pthread_rwlock_init() always passes, regardless
Date: Wed, 8 Nov 2023 05:15:38 +0000
User-agent: Mozilla Thunderbird

Hi,
OS X 10.4 Tiger definitely lacks pthread_rwlock_init() yet gl_cv_func_pthread_rwlock_init is always set to yes via the test in m4/pthread-rwlock.m4

      dnl On Android 4.3, the pthread_rwlock_* functions are declared in
      dnl <pthread.h> but don't exist in libc.
      AC_CACHE_CHECK([for pthread_rwlock_init],
        [gl_cv_func_pthread_rwlock_init],
        [saved_LIBS="$LIBS"
         LIBS="$LIBS $LIBPMULTITHREAD"
         AC_LINK_IFELSE(
           [AC_LANG_SOURCE(
              [[extern
                #ifdef __cplusplus
                "C"
                #endif
                int pthread_rwlock_init (void);
                int main ()
                {
                  return pthread_rwlock_init ();
                }
              ]])],
           [gl_cv_func_pthread_rwlock_init=yes],
           [gl_cv_func_pthread_rwlock_init=no])
         LIBS="$saved_LIBS"
        ])

Compiling the test case with 'cc -Wall -O2 -lpthread' by hand results in Bus Error, the system definitely doesn't support the function (support was added in OS X 10.5). I can sidestep the issue by forcing gl_cv_func_pthread_rwlock_init=no during configure, 'make check' then passes its tests. Otherwise things fail during compilation because it's expecting an implementation from the host. test-pthread.c:33: error: ‘PTHREAD_RWLOCK_INITIALIZER’ undeclared here (not in a function).

Any clues appreciated :)

Sevan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]