patch for libgcrypt 1.2.0 on pthreads
Robey Pointer
robey at danger.com
Tue Jun 29 19:24:37 CEST 2004
Werner Koch wrote:
>On Thu, 24 Jun 2004 16:16:24 -0700, Robey Pointer said:
>
>
>
>>- pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t)); \
>>+ pthread_mutex_t *lock = (pthread_mutex_t *)malloc (sizeof (pthread_mutex_t)); \
>>
>>
>
>malloc returns void* and that type must be assignable to any other
>pointer object. Thus this patch does not make sense for C.
>
>
I won't try to defend gcc. But it gives these errors without the patch:
TLSStream.cpp: In function `int gcry_pthread_mutex_init(void**)':
TLSStream.cpp:18: error: invalid conversion from `void*' to
`pthread_mutex_t*'
TLSStream.cpp: In function `int gcry_pthread_mutex_destroy(void**)':
TLSStream.cpp:18: error: invalid conversion from `void*' to
`pthread_mutex_t*'
TLSStream.cpp: In function `int gcry_pthread_mutex_lock(void**)':
TLSStream.cpp:18: error: invalid conversion from `void*' to
`pthread_mutex_t*'
TLSStream.cpp: In function `int gcry_pthread_mutex_unlock(void**)':
TLSStream.cpp:18: error: invalid conversion from `void*' to
`pthread_mutex_t*'
TLSStream.cpp: At global scope:
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::read'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::write'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::select'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::waitpid'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::accept'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::connect'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::sendmsg'
TLSStream.cpp:18: warning: missing initializer for member `
gcry_thread_cbs::recvmsg'
make: *** [TLSStream.o] Error 1
Line 18 is:
GCRY_THREAD_OPTION_PTHREAD_IMPL;
So gcc (3.3.4) apparently doesn't think these conversions are valid
without casts.
robey
More information about the Gcrypt-devel
mailing list