Wunused-but-set-variable warning treatment
I have the following code, and while compiling it with gcc-4.6 I get warning: warning: variable ‘status’ set but not used [-Wunused-but-set-variable] #if defined (_DEBUG_) #define ASSERT assert #else /* _DEBUG_ */ #define ASSERT( __exp__ ) #endif static inline void cl_plock(cl_plock_t * const p_lock) { status_t status; ASSERT(p_lock); ASSERT(p_lock->state == INITIALIZED); status = pthread_rwlock_unlock(&p_lock->lock); ASSERT(status == 0); } When _DEBUG_ flag isn't set I get the warning. Any ideas how can I workaround this warning? You can change your ASSERT macro to: #if defined (_DEBUG_)