Rifluxyss / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

PTHREAD_RWLOCK_INITIALIZER does not match pthread_rwlock_t #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Create a simple rwlock_test.c file:
#include <pthread.h>
static pthread_rwlock_t myLock = PTHREAD_RWLOCK_INITIALIZER;

Compilation fails with:
<myPath>/project/jni/rwlock_test.c:2: error: missing braces around initializer
<myPath>/project/jni/rwlock_test.c:2: error: (near initialization for 
'myLock.cond')
<myPath>/project/jni/rwlock_test.c:2: error: initialization makes integer from 
pointer without a cast

Looking at android-ndk-r5b/platforms/android-9/arch-arm/usr/include/pthread.h, 
we can see that the initializer doesn't match the struct:
    228 typedef struct {
    229     pthread_mutex_t  lock;
    230     pthread_cond_t   cond;
    231     int              numLocks;
    232     int              writerThreadId;
    233     int              pendingReaders;
    234     int              pendingWriters;
    235     void*            reserved[4];  /* for future extensibility */
    236 } pthread_rwlock_t;
    237
    238 #define PTHREAD_RWLOCK_INITIALIZER  { PTHREAD_MUTEX_INITIALIZER, 0, NULL, 0, 0 }

Original issue reported on code.google.com by sonor...@gmail.com on 7 Mar 2011 at 9:30

GoogleCodeExporter commented 8 years ago
Oops, my apologies, I just noticed that I entered this bug into the wrong tab.
Please disregard this issue.

Original comment by sonor...@gmail.com on 7 Mar 2011 at 9:33

GoogleCodeExporter commented 8 years ago

Original comment by kevin.gaudin on 8 Mar 2011 at 2:24