From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3B07A1F462 for ; Thu, 25 Jul 2019 01:23:26 +0000 (UTC) Received: from localhost ([::1]:55196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqSTc-0007EJ-Lv for normalperson@yhbt.net; Wed, 24 Jul 2019 21:23:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50751) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqSTZ-0007Du-0H for bug-gnulib@gnu.org; Wed, 24 Jul 2019 21:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqSTX-0005nn-BC for bug-gnulib@gnu.org; Wed, 24 Jul 2019 21:23:20 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::10]:16337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hqSTW-0005n4-Iv for bug-gnulib@gnu.org; Wed, 24 Jul 2019 21:23:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1564017796; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=8z4zUSn8zxyhjbESlbRii4x+yHvTE1bdAOuFW3eMfYY=; b=jY7gEq22fvcRy0PpDBgY7satOrn02SslpH3Zsbum/Oivnqe6auEHxxa+Mzft/7EmtA 1zg4q0LScRmB/6DN9fI1cPbwQ6JJV/AQR2jYZGK3lK+D4/ks6InpGFt0sJZYTqKlSqhR w4xeIHkunc+087k3iaOZJ+HI5lfia7QujkKqx+CzWHXVE6frGjHZ4drbZmP9ttWIM3yZ KJ46MPbW29u7S42/pD7ySJrhMVZKrv0ct5mzTiGG6LCEblXJ8FWIqkjs1mI5F4Rsvxb4 pwn8hHUsvVxP4rKOWDA95ft/BRFcl+riKUTQJkYKFbVsglhdZK22TJQW+KPKZ+vELzQC k+pQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGaf0zJZW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id v018bcv6P1NFTPb (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 25 Jul 2019 03:23:15 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: pthread: new set of modules Date: Thu, 25 Jul 2019 03:23:14 +0200 Message-ID: <12533798.QHVoBlITJI@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-154-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <130265586.acqNAWgmtX@omega> References: <130265586.acqNAWgmtX@omega> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::10 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Here's a fix, to make it compile on mingw when module 'pthread-h' is used *without* the modules 'pthread-thread', ..., 'pthread-spin'. 2019-07-24 Bruno Haible pthread-h: Fix definitions of types and macros on mingw. * lib/pthread.in.h (pthread_t, pthread_attr_t, PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED): Define also when module 'pthread-thread' is not in use. (pthread_once_t, PTHREAD_ONCE_INIT): Define also when module 'pthread-once' is not in use. (pthread_mutex_t, pthread_mutexattr_t, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_DEFAULT, PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE): Define also when module 'pthread-mutex' is not in use. (pthread_rwlock_t, pthread_rwlockattr_t, PTHREAD_RWLOCK_INITIALIZER): Define also when module 'pthread-rwlock' is not in use. (pthread_cond_t, pthread_condattr_t, PTHREAD_COND_INITIALIZER): Define also when module 'pthread-cond' is not in use. (pthread_key_t, PTHREAD_DESTRUCTOR_ITERATIONS): Define also when module 'pthread-tss' is not in use. (pthread_spinlock_t): Define also when module 'pthread-spin' is not in use. diff --git a/lib/pthread.in.h b/lib/pthread.in.h index c8963c8..4fc22bf 100644 --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -79,16 +79,28 @@ /* =========== Thread types and macros =========== */ -#if @GNULIB_PTHREAD_THREAD@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-thread.h" -# if @HAVE_PTHREAD_T@ -# define pthread_t rpl_pthread_t -# define pthread_attr_t rpl_pthread_attr_t -# endif -# if !GNULIB_defined_pthread_thread_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_THREAD@ +# include "windows-thread.h" +# if @HAVE_PTHREAD_T@ +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types typedef glwthread_thread_t pthread_t; typedef unsigned int pthread_attr_t; -# define GNULIB_defined_pthread_thread_types 1 +# define GNULIB_defined_pthread_thread_types 1 +# endif +# else +# if @HAVE_PTHREAD_T@ +# define pthread_t rpl_pthread_t +# define pthread_attr_t rpl_pthread_attr_t +# endif +# if !GNULIB_defined_pthread_thread_types +typedef int pthread_t; +typedef unsigned int pthread_attr_t; +# define GNULIB_defined_pthread_thread_types 1 +# endif # endif # undef PTHREAD_CREATE_JOINABLE # undef PTHREAD_CREATE_DETACHED @@ -110,17 +122,29 @@ typedef unsigned int pthread_attr_t; /* =========== Once-only control (initialization) types and macros ========== */ -#if @GNULIB_PTHREAD_ONCE@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-once.h" -# if @HAVE_PTHREAD_T@ -# define pthread_once_t rpl_pthread_once_t -# endif -# if !GNULIB_defined_pthread_once_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_ONCE@ +# include "windows-once.h" +# if @HAVE_PTHREAD_T@ +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types typedef glwthread_once_t pthread_once_t; -# define GNULIB_defined_pthread_once_types 1 +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_once_t rpl_pthread_once_t +# endif +# if !GNULIB_defined_pthread_once_types +typedef int pthread_once_t; +# define GNULIB_defined_pthread_once_types 1 +# endif +# undef PTHREAD_ONCE_INIT +# define PTHREAD_ONCE_INIT { 0 } # endif -# undef PTHREAD_ONCE_INIT -# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_once_types @@ -134,14 +158,15 @@ typedef int pthread_once_t; /* =========== Mutex types and macros =========== */ -#if @GNULIB_PTHREAD_MUTEX@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-timedmutex.h" -# include "windows-timedrecmutex.h" -# if @HAVE_PTHREAD_T@ -# define pthread_mutex_t rpl_pthread_mutex_t -# define pthread_mutexattr_t rpl_pthread_mutexattr_t -# endif -# if !GNULIB_defined_pthread_mutex_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_MUTEX@ +# include "windows-timedmutex.h" +# include "windows-timedrecmutex.h" +# if @HAVE_PTHREAD_T@ +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types typedef struct { int type; @@ -154,10 +179,23 @@ typedef struct } pthread_mutex_t; typedef unsigned int pthread_mutexattr_t; -# define GNULIB_defined_pthread_mutex_types 1 +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } } +# else +# if @HAVE_PTHREAD_T@ +# define pthread_mutex_t rpl_pthread_mutex_t +# define pthread_mutexattr_t rpl_pthread_mutexattr_t +# endif +# if !GNULIB_defined_pthread_mutex_types +typedef int pthread_mutex_t; +typedef unsigned int pthread_mutexattr_t; +# define GNULIB_defined_pthread_mutex_types 1 +# endif +# undef PTHREAD_MUTEX_INITIALIZER +# define PTHREAD_MUTEX_INITIALIZER { 0 } # endif -# undef PTHREAD_MUTEX_INITIALIZER -# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } } # undef PTHREAD_MUTEX_DEFAULT # undef PTHREAD_MUTEX_NORMAL # undef PTHREAD_MUTEX_ERRORCHECK @@ -194,19 +232,33 @@ typedef unsigned int pthread_mutexattr_t; /* =========== Read-write lock types and macros =========== */ -#if @GNULIB_PTHREAD_RWLOCK@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-timedrwlock.h" -# if @HAVE_PTHREAD_T@ -# define pthread_rwlock_t rpl_pthread_rwlock_t -# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t -# endif -# if !GNULIB_defined_pthread_rwlock_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_RWLOCK@ +# include "windows-timedrwlock.h" +# if @HAVE_PTHREAD_T@ +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types typedef glwthread_timedrwlock_t pthread_rwlock_t; typedef unsigned int pthread_rwlockattr_t; -# define GNULIB_defined_pthread_rwlock_types 1 +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_rwlock_t rpl_pthread_rwlock_t +# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t +# endif +# if !GNULIB_defined_pthread_rwlock_types +typedef int pthread_rwlock_t; +typedef unsigned int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_rwlock_types 1 +# endif +# undef PTHREAD_RWLOCK_INITIALIZER +# define PTHREAD_RWLOCK_INITIALIZER { 0 } # endif -# undef PTHREAD_RWLOCK_INITIALIZER -# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT #elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */ # if @HAVE_PTHREAD_T@ # define pthread_rwlock_t rpl_pthread_rwlock_t @@ -242,19 +294,33 @@ typedef unsigned int pthread_rwlockattr_t; /* =========== Condition variable types and macros =========== */ -#if @GNULIB_PTHREAD_COND@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-cond.h" -# if @HAVE_PTHREAD_T@ -# define pthread_cond_t rpl_pthread_cond_t -# define pthread_condattr_t rpl_pthread_condattr_t -# endif -# if !GNULIB_defined_pthread_cond_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_COND@ +# include "windows-cond.h" +# if @HAVE_PTHREAD_T@ +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types typedef glwthread_cond_t pthread_cond_t; typedef unsigned int pthread_condattr_t; -# define GNULIB_defined_pthread_cond_types 1 +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT +# else +# if @HAVE_PTHREAD_T@ +# define pthread_cond_t rpl_pthread_cond_t +# define pthread_condattr_t rpl_pthread_condattr_t +# endif +# if !GNULIB_defined_pthread_cond_types +typedef int pthread_cond_t; +typedef unsigned int pthread_condattr_t; +# define GNULIB_defined_pthread_cond_types 1 +# endif +# undef PTHREAD_COND_INITIALIZER +# define PTHREAD_COND_INITIALIZER { 0 } # endif -# undef PTHREAD_COND_INITIALIZER -# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_cond_types @@ -269,17 +335,29 @@ typedef unsigned int pthread_condattr_t; /* =========== Thread-specific storage types and macros =========== */ -#if @GNULIB_PTHREAD_TSS@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-tls.h" -# if @HAVE_PTHREAD_T@ -# define pthread_key_t rpl_pthread_key_t -# endif -# if !GNULIB_defined_pthread_tss_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_TSS@ +# include "windows-tls.h" +# if @HAVE_PTHREAD_T@ +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types typedef glwthread_tls_key_t pthread_key_t; -# define GNULIB_defined_pthread_tss_types 1 +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS +# else +# if @HAVE_PTHREAD_T@ +# define pthread_key_t rpl_pthread_key_t +# endif +# if !GNULIB_defined_pthread_tss_types +typedef void ** pthread_key_t; +# define GNULIB_defined_pthread_tss_types 1 +# endif +# undef PTHREAD_DESTRUCTOR_ITERATIONS +# define PTHREAD_DESTRUCTOR_ITERATIONS 0 # endif -# undef PTHREAD_DESTRUCTOR_ITERATIONS -# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS #else # if !@HAVE_PTHREAD_T@ # if !GNULIB_defined_pthread_tss_types @@ -293,14 +371,24 @@ typedef void ** pthread_key_t; /* =========== Spinlock types and macros =========== */ -#if @GNULIB_PTHREAD_SPIN@ && (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS -# include "windows-spin.h" -# if @HAVE_PTHREAD_T@ -# define pthread_spinlock_t rpl_pthread_spinlock_t -# endif -# if !GNULIB_defined_pthread_spin_types +#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS +# if @GNULIB_PTHREAD_SPIN@ +# include "windows-spin.h" +# if @HAVE_PTHREAD_T@ +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types typedef glwthread_spinlock_t pthread_spinlock_t; -# define GNULIB_defined_pthread_spin_types 1 +# define GNULIB_defined_pthread_spin_types 1 +# endif +# else +# if @HAVE_PTHREAD_T@ +# define pthread_spinlock_t rpl_pthread_spinlock_t +# endif +# if !GNULIB_defined_pthread_spin_types +typedef pthread_mutex_t pthread_spinlock_t; +# define GNULIB_defined_pthread_spin_types 1 +# endif # endif # undef PTHREAD_PROCESS_PRIVATE # undef PTHREAD_PROCESS_SHARED