Ignore:
Timestamp:
Feb 18, 2025, 12:54:23 PM (6 weeks ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
8705a11
Parents:
3e5fea2
Message:

Clean-up the warnings of the concurrency tests. A lot of little test level fixes, the most interesting repeated one is some formally redundent fallthough statements. pthread_attr_test had to be rewritten because of library restrictions. Changed some types so they would always be pointer sized. There was a library change, there was a function that could not be implemented; I trust that it is included for a reason so I just put it in a comment. There is a change to the compiler, wait-until now uses goto. The labelled breaks were code generated as unlabelled breaks and although it worked out slipped through some checks. Finally, there is one warning that I cannot solve at this time so tests that produce it have been put in their own lax group.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tests/concurrency/pthread/pthread_key_test.cfa

    r3e5fea2 rd923fca  
    1616    #define BUFFSZ  48
    1717    pthread_key_t   key;
    18     volatile int total_value,total_value_getspec;
     18    volatile size_t total_value;
     19    volatile size_t total_value_getspec;
    1920    pthread_mutex_t value_mutex;
    2021
     
    2627        int       *tnum;
    2728        void      *getvalue;
    28         char       Buffer[BUFFSZ];
    2929
    3030        tnum = (int*)parm;
     
    3232
    3333        //printf("Thread %d executing\n", threadnum);
    34         value = (void *)(rand()%100);
     34        value = (void *)(size_t)(rand()%100);
    3535        status = pthread_setspecific(key, (void *) value);
    3636        if ( status !=  0) {
     
    4040        }
    4141        pthread_mutex_lock(&value_mutex);
    42         total_value_getspec += (int)value;
    43         total_value += (int)pthread_getspecific(key);
     42        total_value_getspec += (size_t)value;
     43        total_value += (size_t)pthread_getspecific(key);
    4444        pthread_mutex_unlock(&value_mutex);
    4545
    4646
    47         if (!(value = malloc(sizeof(Buffer))))
     47        if (!(value = malloc(BUFFSZ)))
    4848            printf("Thread %d could not allocate storage, errno = %d\n",
    4949                                                        threadnum, errno);
     
    6060
    6161        if (getvalue != value) {
    62         printf("getvalue not valid, getvalue=%d", (u_int64_t)getvalue);
     62            printf("getvalue not valid, getvalue=%p", getvalue);
    6363            return (void*)68;
    6464        }
     
    7676
    7777    int main() {
    78         int          getvalue;
    7978        int          status;
    8079        int          i;
     
    116115
    117116            if (thread_stat[i] != 0)   {
    118                 printf("bad thread status, thread %d, status=%d\n", i+1,
    119                                                         (u_int64_t)thread_stat[i]);
     117                printf("bad thread status, thread %d, status=%zd\n", i+1,
     118                                                        (size_t)thread_stat[i]);
    120119            }
    121120        }
    122         printf("total value is %d, total value by pthread_getspecific is %d\n", total_value, total_value_getspec);
     121        printf("total value is %zd, total value by pthread_getspecific is %zd\n", total_value, total_value_getspec);
    123122        exit(0);
    124123    }   // main
Note: See TracChangeset for help on using the changeset viewer.