Home | History | Annotate | Download | only in tests
      1 /**
      2  * @file  rwlock_type_checking.c
      3  *
      4  * @brief Test whether DRD reports attempts to use a user-defined rwlock as
      5  *        a POSIX rwlock and vice versa.
      6  */
      7 
      8 
      9 #define _GNU_SOURCE 1
     10 
     11 #include <pthread.h>
     12 #include <stdio.h>
     13 #include <string.h>
     14 #include "../../config.h"
     15 #include "../../drd/drd.h"
     16 
     17 
     18 int main(int argc, char** argv)
     19 {
     20   pthread_rwlock_t posix_rwlock;
     21   pthread_rwlock_t user_defined_rwlock;
     22 
     23   memset(&user_defined_rwlock, 0, sizeof(user_defined_rwlock));
     24   ANNOTATE_RWLOCK_CREATE(&user_defined_rwlock);
     25   pthread_rwlock_init(&posix_rwlock, 0);
     26 
     27   pthread_rwlock_init((pthread_rwlock_t*)&user_defined_rwlock, 0);
     28 
     29   ANNOTATE_READERLOCK_RELEASED(&posix_rwlock);
     30 
     31   pthread_rwlock_destroy(&posix_rwlock);
     32   ANNOTATE_RWLOCK_DESTROY(&user_defined_rwlock);
     33 
     34   fprintf(stderr, "Finished.\n");
     35 
     36   return 0;
     37 }
     38