inline int fclose(FILE *stream) { __CPROVER_HIDE:; #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS __CPROVER_assert(__CPROVER_get_must(stream, "open"), "fclose file must be open"); __CPROVER_clear_must(stream, "open"); __CPROVER_set_must(stream, "closed"); #endif int return_value; free(stream); return return_value; }
inline int pthread_create( pthread_t *thread, const pthread_attr_t *attr, void * (*start_routine)(void *), void *arg) { __CPROVER_HIDE:; unsigned long this_thread_id; __CPROVER_atomic_begin(); this_thread_id=++__CPROVER_next_thread_id; __CPROVER_atomic_end(); if(thread) { #ifdef __APPLE__ // pthread_t is a pointer type on the Mac *thread=(pthread_t)this_thread_id; #else *thread=this_thread_id; #endif } #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS __CPROVER_set_must(thread, "pthread-id"); #endif if(attr) (void)*attr; __CPROVER_ASYNC_1: __CPROVER_thread_id=this_thread_id, #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS // Clear all locked mutexes; locking must happen in same thread. __CPROVER_clear_must(0, "mutex-locked"), __CPROVER_clear_may(0, "mutex-locked"), #endif start_routine(arg), __CPROVER_fence("WWfence", "RRfence", "RWfence", "WRfence", "WWcumul", "RRcumul", "RWcumul", "WRcumul"), __CPROVER_threads_exited[this_thread_id]=1; return 0; }