bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* pthread-thread: fix prototype of pthread_attr_getdetachstate
@ 2019-11-20  1:31 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2019-11-20  1:31 UTC (permalink / raw)
  To: bug-gnulib

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  <bruno@clisp.org>

	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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-20  1:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20  1:31 pthread-thread: fix prototype of pthread_attr_getdetachstate Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).