bug-gnulib
[Top][All Lists]
Advanced

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

pthread-thread: fix prototype of pthread_attr_getdetachstate


From: Bruno Haible
Subject: pthread-thread: fix prototype of pthread_attr_getdetachstate
Date: Wed, 20 Nov 2019 02:31:36 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; )

Noticed this while building a testdir of
$ ./gnulib-tool --create-testdir --dir=/tmp/testdir --single-configure \
  --with-c++-tests --avoid=math-c++-tests inet_ntop scandir alphasort \
  getaddrinfo vdprintf-posix vfprintf-posix vprintf-posix vsprintf-posix \
  connect accept bind getpeername getsockname getsockopt recvfrom sendto \
  setsockopt mknod gettimeofday getcwd gethostname getlogin_r read \
  sethostname write


2019-11-19  Bruno Haible  <address@hidden>

        pthread-thread: Fix prototype of pthread_attr_getdetachstate.
        * lib/pthread.in.h (pthread_attr_getdetachstate): Change first parameter
        to 'const pthread_attr_t *'.
        * lib/pthread-thread.c (pthread_attr_getdetachstate): Likewise.
        * tests/test-pthread-c++.cc (pthread_attr_getdetachstate): Likewise.

diff --git a/lib/pthread-thread.c b/lib/pthread-thread.c
index 43f1ec4..8f0033d 100644
--- a/lib/pthread-thread.c
+++ b/lib/pthread-thread.c
@@ -39,7 +39,7 @@ pthread_attr_init (pthread_attr_t *attr)
 }
 
 int
-pthread_attr_getdetachstate (pthread_attr_t *attr, int *detachstatep)
+pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstatep)
 {
   *detachstatep = *attr & (PTHREAD_CREATE_JOINABLE | PTHREAD_CREATE_DETACHED);
   return 0;
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index 4fc22bf..9c0a422 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -509,18 +509,18 @@ _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is 
not portable - "
 #   define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
 #  endif
 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
-                  (pthread_attr_t *attr, int *detachstatep)
+                  (const pthread_attr_t *attr, int *detachstatep)
                   _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
-                  (pthread_attr_t *attr, int *detachstatep));
+                  (const pthread_attr_t *attr, int *detachstatep));
 # else
 #  if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
-                  (pthread_attr_t *attr, int *detachstatep)
+                  (const pthread_attr_t *attr, int *detachstatep)
                   _GL_ARG_NONNULL ((1, 2)));
 #  endif
 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
-                  (pthread_attr_t *attr, int *detachstatep));
+                  (const pthread_attr_t *attr, int *detachstatep));
 # endif
 _GL_CXXALIASWARN (pthread_attr_getdetachstate);
 #elif defined GNULIB_POSIXCHECK
diff --git a/tests/test-pthread-c++.cc b/tests/test-pthread-c++.cc
index 60e845c..aa221bc 100644
--- a/tests/test-pthread-c++.cc
+++ b/tests/test-pthread-c++.cc
@@ -38,7 +38,7 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_init, int, 
(pthread_attr_t *));
 
 #if GNULIB_TEST_PTHREAD_THREAD
 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_getdetachstate, int,
-                 (pthread_attr_t *, int *));
+                 (const pthread_attr_t *, int *));
 #endif
 
 #if GNULIB_TEST_PTHREAD_THREAD




reply via email to

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