From: Julian Seward Date: Mon, 28 Mar 2011 16:26:42 +0000 (+0000) Subject: Fix up most but not all warnings generated by gcc-4.6 about X-Git-Tag: svn/VALGRIND_3_7_0~561 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c6d0dc9c98f5f9ebe95b60e66b673019892a8d2;p=thirdparty%2Fvalgrind.git Fix up most but not all warnings generated by gcc-4.6 about dead assignments ("[-Wunused-but-set-variable]"). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11673 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index e59b228629..4aa9286dd0 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -3410,7 +3410,6 @@ void* /* really, XArray* of StackBlock */ /* This is a derivation of consider_vars_in_frame() above. */ Word i; DebugInfo* di; - RegSummary regs; Bool debug = False; XArray* res = VG_(newXA)( ML_(dinfo_zalloc), "di.debuginfo.dgsbai.1", @@ -3462,9 +3461,6 @@ void* /* really, XArray* of StackBlock */ variables on each such address range found are in scope right now. Don't descend to level zero as that is the global scope. */ - regs.ip = ip; - regs.sp = 0; - regs.fp = 0; /* "for each scope, working outwards ..." */ for (i = VG_(sizeXA)(di->varinfo) - 1; i >= 1; i--) { diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 5f1d2cea4e..4e93bb2584 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -990,7 +990,7 @@ void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, UInt acode, abcode; ULong atoffs, blklen; Int level; - UShort ver; + /* UShort ver; */ UChar addr_size; UChar* p = unitblock_img; @@ -1007,7 +1007,7 @@ void read_unitinfo_dwarf2( /*OUT*/UnitInfo* ui, p += ui->dw64 ? 12 : 4; /* version should be 2, 3 or 4 */ - ver = *((UShort*)p); + /* ver = *((UShort*)p); */ p += 2; /* get offset in abbrev */ diff --git a/coregrind/m_debuginfo/readpdb.c b/coregrind/m_debuginfo/readpdb.c index f612a08777..8a8fc7f3b7 100644 --- a/coregrind/m_debuginfo/readpdb.c +++ b/coregrind/m_debuginfo/readpdb.c @@ -2101,21 +2101,21 @@ static void pdb_dump( struct pdb_reader* pdb, */ file = symbols_image + header_size; while ( file - symbols_image < header_size + symbols.module_size ) { - int file_nr, file_index, symbol_size, lineno_size; + int file_nr, /* file_index, */ symbol_size, lineno_size; char *file_name; if ( symbols.version < 19970000 ) { PDB_SYMBOL_FILE *sym_file = (PDB_SYMBOL_FILE *) file; file_nr = sym_file->file; file_name = sym_file->filename; - file_index = sym_file->range.index; + /* file_index = sym_file->range.index; */ /* UNUSED */ symbol_size = sym_file->symbol_size; lineno_size = sym_file->lineno_size; } else { PDB_SYMBOL_FILE_EX *sym_file = (PDB_SYMBOL_FILE_EX *) file; file_nr = sym_file->file; file_name = sym_file->filename; - file_index = sym_file->range.index; + /* file_index = sym_file->range.index; */ /* UNUSED */ symbol_size = sym_file->symbol_size; lineno_size = sym_file->lineno_size; } diff --git a/coregrind/m_debuginfo/readstabs.c b/coregrind/m_debuginfo/readstabs.c index e91faf42a9..6d00797075 100644 --- a/coregrind/m_debuginfo/readstabs.c +++ b/coregrind/m_debuginfo/readstabs.c @@ -326,13 +326,11 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, case N_FUN: { /* function start/end */ Addr addr = 0; /* end address for prev line/scope */ - Bool newfunc = False; /* if this the end of the function or we haven't previously finished the previous function... */ if (*string == '\0' || func.start != 0) { /* end of function */ - newfunc = False; line.first = False; /* end line at end of function */ @@ -346,7 +344,6 @@ void ML_(read_debuginfo_stabs) ( DebugInfo* di, if (*string != '\0') { /* new function */ - newfunc = True; line.first = True; /* line ends at start of next function */ diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index 5ec7a90f75..257d946848 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -1013,7 +1013,7 @@ static void add_to_buf ( HChar c, void* p ) void VG_(debugLog) ( Int level, const HChar* modulename, const HChar* format, ... ) { - UInt ret, pid; + UInt pid; Int indent, depth, i; va_list vargs; printf_buf buf; @@ -1045,7 +1045,7 @@ void VG_(debugLog) ( Int level, const HChar* modulename, va_start(vargs,format); - ret = VG_(debugLog_vprintf) ( add_to_buf, &buf, format, vargs ); + (void) VG_(debugLog_vprintf) ( add_to_buf, &buf, format, vargs ); if (buf.n > 0) { emit( buf.buf, local_strlen(buf.buf) ); diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 389fd4c18c..dee9e56653 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -233,14 +233,13 @@ static void add_to__snprintf_buf ( HChar c, void* p ) UInt VG_(vsnprintf) ( Char* buf, Int size, const HChar *format, va_list vargs ) { - Int ret; snprintf_buf_t b; b.buf = buf; b.buf_size = size < 0 ? 0 : size; b.buf_used = 0; - ret = VG_(debugLog_vprintf) - ( add_to__snprintf_buf, &b, format, vargs ); + (void) VG_(debugLog_vprintf) + ( add_to__snprintf_buf, &b, format, vargs ); return b.buf_used; } diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index d832d307d2..042d98513a 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -506,7 +506,7 @@ Bool VG_(machine_get_hwcaps)( void ) #if defined(VGA_x86) { Bool have_sse1, have_sse2, have_cx8, have_lzcnt; - UInt eax, ebx, ecx, edx, max_basic, max_extended; + UInt eax, ebx, ecx, edx, max_extended; UChar vstr[13]; vstr[0] = 0; @@ -521,7 +521,6 @@ Bool VG_(machine_get_hwcaps)( void ) /* Get processor ID string, and max basic/extended index values. */ - max_basic = eax; VG_(memcpy)(&vstr[0], &ebx, 4); VG_(memcpy)(&vstr[4], &edx, 4); VG_(memcpy)(&vstr[8], &ecx, 4); @@ -575,9 +574,9 @@ Bool VG_(machine_get_hwcaps)( void ) } #elif defined(VGA_amd64) - { Bool have_sse1, have_sse2, have_sse3, have_cx8, have_cx16; + { Bool have_sse3, have_cx8, have_cx16; Bool have_lzcnt; - UInt eax, ebx, ecx, edx, max_basic, max_extended; + UInt eax, ebx, ecx, edx, max_extended; UChar vstr[13]; vstr[0] = 0; @@ -592,7 +591,6 @@ Bool VG_(machine_get_hwcaps)( void ) /* Get processor ID string, and max basic/extended index values. */ - max_basic = eax; VG_(memcpy)(&vstr[0], &ebx, 4); VG_(memcpy)(&vstr[4], &edx, 4); VG_(memcpy)(&vstr[8], &ecx, 4); @@ -604,8 +602,7 @@ Bool VG_(machine_get_hwcaps)( void ) /* get capabilities bits into edx */ VG_(cpuid)(1, &eax, &ebx, &ecx, &edx); - have_sse1 = (edx & (1<<25)) != 0; /* True => have sse insns */ - have_sse2 = (edx & (1<<26)) != 0; /* True => have sse2 insns */ + // we assume that SSE1 and SSE2 are available by default have_sse3 = (ecx & (1<<0)) != 0; /* True => have sse3 insns */ // ssse3 is ecx:9 // sse41 is ecx:19 diff --git a/coregrind/m_main.c b/coregrind/m_main.c index acfcdda78f..e9bfe20906 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1811,8 +1811,7 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) nul[0] = 0; exename = VG_(args_the_exename) ? VG_(args_the_exename) : "unknown_exename"; - VG_(write)(fd, VG_(args_the_exename), - VG_(strlen)( VG_(args_the_exename) )); + VG_(write)(fd, exename, VG_(strlen)( exename )); VG_(write)(fd, nul, 1); for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) { diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 95756d24e0..9d2cb44fbb 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -850,7 +850,7 @@ ZONE_CHECK(VG_Z_LIBC_SONAME, malloc_zone_check); __attribute__((constructor)) static void init(void) { - int res; + int res __attribute__((unused)); // This doesn't look thread-safe, but it should be ok... Bart says: // diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 417176209f..65fc40a051 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -1414,8 +1414,10 @@ void VG_(kill_self)(Int sigNo) VG_(sigprocmask)(VKI_SIG_UNBLOCK, &mask, &origmask); r = VG_(kill)(VG_(getpid)(), sigNo); +# if defined(VGO_linux) /* This sometimes fails with EPERM on Darwin. I don't know why. */ - /* vg_assert(r == 0); */ + vg_assert(r == 0); +# endif VG_(convert_sigaction_fromK_to_toK)( &origsa, &origsa2 ); VG_(sigaction)(sigNo, &origsa2, NULL); diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 864f38d358..fae4854fbe 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -1258,8 +1258,7 @@ Bool VG_(translate) ( ThreadId tid, Addr64 addr; T_Kind kind; Int tmpbuf_used, verbosity, i; - Bool notrace_until_done, do_self_check; - UInt notrace_until_limit = 0; + Bool do_self_check; Bool (*preamble_fn)(void*,IRSB*); VexArch vex_arch; VexArchInfo vex_archinfo; @@ -1320,15 +1319,6 @@ Bool VG_(translate) ( ThreadId tid, addr, name2 ); } - /* If codegen tracing, don't start tracing until - notrace_until_limit blocks have gone by. This avoids printing - huge amounts of useless junk when all we want to see is the last - few blocks translated prior to a failure. Set - notrace_until_limit to be the number of translations to be made - before --trace-codegen= style printing takes effect. */ - notrace_until_done - = VG_(get_bbs_translated)() >= notrace_until_limit; - if (!debugging_translation) VG_TRACK( pre_mem_read, Vg_CoreTranslate, tid, "(translator)", addr, 1 ); diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c index 39e6f0b5a5..678d16fee2 100644 --- a/coregrind/m_ume/elf.c +++ b/coregrind/m_ume/elf.c @@ -305,7 +305,7 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) ESZ(Addr) maxaddr = 0; /* highest mapped address */ ESZ(Addr) interp_addr = 0; /* interpreter (ld.so) address */ ESZ(Word) interp_size = 0; /* interpreter size */ - ESZ(Word) interp_align = VKI_PAGE_SIZE; + /* ESZ(Word) interp_align = VKI_PAGE_SIZE; */ /* UNUSED */ Int i; void *entry; ESZ(Addr) ebase = 0; @@ -395,7 +395,7 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) if (!baseaddr_set) { interp_addr = iph->p_vaddr; - interp_align = iph->p_align; + /* interp_align = iph->p_align; */ /* UNUSED */ baseaddr_set = 1; } @@ -504,6 +504,7 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) #else info->init_ip = (Addr)entry; info->init_toc = 0; /* meaningless on this platform */ + (void) interp_offset; /* stop gcc complaining it is unused */ #endif VG_(free)(e->p); VG_(free)(e); diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c index f74b52af92..863c7743fa 100644 --- a/coregrind/vg_preloaded.c +++ b/coregrind/vg_preloaded.c @@ -56,7 +56,7 @@ void VG_NOTIFY_ON_LOAD(freeres)( void ); void VG_NOTIFY_ON_LOAD(freeres)( void ) { - int res; + int res __attribute__((unused)); #if !defined(__UCLIBC__) && !defined(VGO_aix5) extern void __libc_freeres(void); __libc_freeres(); @@ -77,7 +77,7 @@ void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void) { OrigFn fn; Addr result = 0; - int res; + int res __attribute__((unused)); /* Call the original indirect function and get it's result */ VALGRIND_GET_ORIG_FN(fn); diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index 43cd63748e..3c9f039c1e 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -235,7 +235,7 @@ static __always_inline MutexT DRD_(mutex_type)(pthread_mutex_t* mutex) */ static void DRD_(set_joinable)(const pthread_t tid, const int joinable) { - int res; + int res __attribute__((unused)); assert(joinable == 0 || joinable == 1); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__SET_JOINABLE, tid, joinable, 0, 0, 0); @@ -244,7 +244,7 @@ static void DRD_(set_joinable)(const pthread_t tid, const int joinable) /** Tell DRD that the calling thread is about to enter pthread_create(). */ static __always_inline void DRD_(entering_pthread_create)(void) { - int res; + int res __attribute__((unused)); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__ENTERING_PTHREAD_CREATE, 0, 0, 0, 0, 0); } @@ -252,7 +252,7 @@ static __always_inline void DRD_(entering_pthread_create)(void) /** Tell DRD that the calling thread has left pthread_create(). */ static __always_inline void DRD_(left_pthread_create)(void) { - int res; + int res __attribute__((unused)); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__LEFT_PTHREAD_CREATE, 0, 0, 0, 0, 0); } @@ -263,7 +263,7 @@ static __always_inline void DRD_(left_pthread_create)(void) */ static void* DRD_(thread_wrapper)(void* arg) { - int res; + int res __attribute__((unused)); DrdPosixThreadArgs* arg_ptr; DrdPosixThreadArgs arg_copy; @@ -348,7 +348,7 @@ static void DRD_(check_threading_library)(void) */ static void DRD_(set_main_thread_state)(void) { - int res; + int res __attribute__((unused)); // Make sure that DRD knows about the main thread's POSIX thread ID. VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__SET_PTHREADID, @@ -377,7 +377,7 @@ static __always_inline int pthread_create_intercept(pthread_t* thread, const pthread_attr_t* attr, void* (*start)(void*), void* arg) { - int res; + int res __attribute__((unused)); int ret; OrigFn fn; DrdPosixThreadArgs thread_args; @@ -428,7 +428,7 @@ static __always_inline int pthread_join_intercept(pthread_t pt_joinee, void **thread_return) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); @@ -467,7 +467,7 @@ PTH_FUNCS(int, pthreadZudetach, pthread_detach_intercept, static __always_inline int pthread_cancel_intercept(pthread_t pt_thread) { - int res; + int res __attribute__((unused)); int ret; OrigFn fn; VALGRIND_GET_ORIG_FN(fn); @@ -509,7 +509,7 @@ int pthread_mutex_init_intercept(pthread_mutex_t *mutex, const pthread_mutexattr_t* attr) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; int mt; VALGRIND_GET_ORIG_FN(fn); @@ -533,7 +533,7 @@ static __always_inline int pthread_mutex_destroy_intercept(pthread_mutex_t* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_DESTROY, @@ -551,7 +551,7 @@ static __always_inline int pthread_mutex_lock_intercept(pthread_mutex_t* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -569,7 +569,7 @@ static __always_inline int pthread_mutex_trylock_intercept(pthread_mutex_t* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -588,7 +588,7 @@ int pthread_mutex_timedlock_intercept(pthread_mutex_t *mutex, const struct timespec *abs_timeout) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -607,7 +607,7 @@ static __always_inline int pthread_mutex_unlock_intercept(pthread_mutex_t *mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, @@ -628,7 +628,7 @@ int pthread_cond_init_intercept(pthread_cond_t* cond, const pthread_condattr_t* attr) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_INIT, @@ -647,7 +647,7 @@ static __always_inline int pthread_cond_destroy_intercept(pthread_cond_t* cond) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_DESTROY, @@ -665,7 +665,7 @@ static __always_inline int pthread_cond_wait_intercept(pthread_cond_t *cond, pthread_mutex_t *mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_WAIT, @@ -686,7 +686,7 @@ int pthread_cond_timedwait_intercept(pthread_cond_t *cond, const struct timespec* abstime) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_WAIT, @@ -712,7 +712,7 @@ static __always_inline int pthread_cond_signal_intercept(pthread_cond_t* cond) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_SIGNAL, @@ -730,7 +730,7 @@ static __always_inline int pthread_cond_broadcast_intercept(pthread_cond_t* cond) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_COND_BROADCAST, @@ -749,7 +749,7 @@ static __always_inline int pthread_spin_init_intercept(pthread_spinlock_t *spinlock, int pshared) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK, @@ -767,7 +767,7 @@ static __always_inline int pthread_spin_destroy_intercept(pthread_spinlock_t *spinlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_DESTROY, @@ -785,7 +785,7 @@ static __always_inline int pthread_spin_lock_intercept(pthread_spinlock_t *spinlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -803,7 +803,7 @@ static __always_inline int pthread_spin_trylock_intercept(pthread_spinlock_t *spinlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -821,7 +821,7 @@ static __always_inline int pthread_spin_unlock_intercept(pthread_spinlock_t *spinlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK, @@ -844,7 +844,7 @@ int pthread_barrier_init_intercept(pthread_barrier_t* barrier, unsigned count) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_BARRIER_INIT, @@ -863,7 +863,7 @@ static __always_inline int pthread_barrier_destroy_intercept(pthread_barrier_t* barrier) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_BARRIER_DESTROY, @@ -881,7 +881,7 @@ static __always_inline int pthread_barrier_wait_intercept(pthread_barrier_t* barrier) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_BARRIER_WAIT, @@ -903,7 +903,7 @@ static __always_inline int sem_init_intercept(sem_t *sem, int pshared, unsigned int value) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_INIT, @@ -921,7 +921,7 @@ static __always_inline int sem_destroy_intercept(sem_t *sem) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_DESTROY, @@ -939,7 +939,7 @@ sem_t* sem_open_intercept(const char *name, int oflag, mode_t mode, unsigned int value) { sem_t *ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_OPEN, @@ -958,7 +958,7 @@ PTH_FUNCS(sem_t *, semZuopen, sem_open_intercept, static __always_inline int sem_close_intercept(sem_t *sem) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_CLOSE, @@ -974,7 +974,7 @@ PTH_FUNCS(int, semZuclose, sem_close_intercept, (sem_t *sem), (sem)); static __always_inline int sem_wait_intercept(sem_t *sem) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_WAIT, @@ -990,7 +990,7 @@ PTH_FUNCS(int, semZuwait, sem_wait_intercept, (sem_t *sem), (sem)); static __always_inline int sem_trywait_intercept(sem_t *sem) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_WAIT, @@ -1007,7 +1007,7 @@ static __always_inline int sem_timedwait_intercept(sem_t *sem, const struct timespec *abs_timeout) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_WAIT, @@ -1025,7 +1025,7 @@ PTH_FUNCS(int, semZutimedwait, sem_timedwait_intercept, static __always_inline int sem_post_intercept(sem_t *sem) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_POST, @@ -1043,7 +1043,7 @@ int pthread_rwlock_init_intercept(pthread_rwlock_t* rwlock, const pthread_rwlockattr_t* attr) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_INIT, @@ -1061,7 +1061,7 @@ static __always_inline int pthread_rwlock_destroy_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); CALL_FN_W_W(ret, fn, rwlock); @@ -1078,7 +1078,7 @@ static __always_inline int pthread_rwlock_rdlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK, @@ -1097,7 +1097,7 @@ static __always_inline int pthread_rwlock_wrlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK, @@ -1116,7 +1116,7 @@ static __always_inline int pthread_rwlock_timedrdlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK, @@ -1135,7 +1135,7 @@ static __always_inline int pthread_rwlock_timedwrlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK, @@ -1154,7 +1154,7 @@ static __always_inline int pthread_rwlock_tryrdlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_RDLOCK, @@ -1173,7 +1173,7 @@ static __always_inline int pthread_rwlock_trywrlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_WRLOCK, @@ -1192,7 +1192,7 @@ static __always_inline int pthread_rwlock_unlock_intercept(pthread_rwlock_t* rwlock) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_RWLOCK_UNLOCK, diff --git a/drd/drd_qtcore_intercepts.c b/drd/drd_qtcore_intercepts.c index e040d08812..be1c5c9a9d 100644 --- a/drd/drd_qtcore_intercepts.c +++ b/drd/drd_qtcore_intercepts.c @@ -90,7 +90,7 @@ QT4CORE_FUNC(void, _ZN6QMutexC1ENS_13RecursionModeE, qt_mutex_mode mode) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_INIT, @@ -106,7 +106,7 @@ QT4CORE_FUNC(void, _ZN6QMutexC2ENS_13RecursionModeE, qt_mutex_mode mode) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_INIT, @@ -121,7 +121,7 @@ QT4CORE_FUNC(void, _ZN6QMutexD1Ev, void* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_DESTROY, @@ -136,7 +136,7 @@ QT4CORE_FUNC(void, _ZN6QMutexD2Ev, void** mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_MUTEX_DESTROY, @@ -151,7 +151,7 @@ QT4CORE_FUNC(void, _ZN6QMutex4lockEv, void* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -166,7 +166,7 @@ QT4CORE_FUNC(int, _ZN6QMutex7tryLockEv, void* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -183,7 +183,7 @@ QT4CORE_FUNC(int, _ZN6QMutex7tryLockEi, int timeout_ms) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__PRE_MUTEX_LOCK, @@ -199,7 +199,7 @@ QT4CORE_FUNC(void, _ZN6QMutex6unlockEv, void* mutex) { int ret; - int res; + int res __attribute__((unused)); OrigFn fn; VALGRIND_GET_ORIG_FN(fn); VALGRIND_DO_CLIENT_REQUEST(res, -1, diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c index 82eb941b7b..810a289a3b 100644 --- a/exp-dhat/dh_main.c +++ b/exp-dhat/dh_main.c @@ -452,7 +452,7 @@ void* new_block ( ThreadId tid, void* p, SizeT req_szB, SizeT req_alignB, Bool is_zeroed ) { tl_assert(p == NULL); // don't handle custom allocators right now - SizeT actual_szB, slop_szB; + SizeT actual_szB /*, slop_szB*/; if ((SSizeT)req_szB < 0) return NULL; @@ -468,9 +468,9 @@ void* new_block ( ThreadId tid, void* p, SizeT req_szB, SizeT req_alignB, if (is_zeroed) VG_(memset)(p, 0, req_szB); actual_szB = VG_(malloc_usable_size)(p); tl_assert(actual_szB >= req_szB); - slop_szB = actual_szB - req_szB; + /* slop_szB = actual_szB - req_szB; */ } else { - slop_szB = 0; + /* slop_szB = 0; */ } // Make new HP_Chunk node, add to malloc_list diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 01e6ab27c5..a31dc0da44 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -86,7 +86,8 @@ #define DO_CREQ_v_W(_creqF, _ty1F,_arg1F) \ do { \ - Word _unused_res, _arg1; \ + Word _unused_res __attribute__((unused)); \ + Word _arg1; \ assert(sizeof(_ty1F) == sizeof(Word)); \ _arg1 = (Word)(_arg1F); \ VALGRIND_DO_CLIENT_REQUEST(_unused_res, 0, \ @@ -96,7 +97,8 @@ #define DO_CREQ_v_WW(_creqF, _ty1F,_arg1F, _ty2F,_arg2F) \ do { \ - Word _unused_res, _arg1, _arg2; \ + Word _unused_res __attribute__((unused)); \ + Word _arg1, _arg2; \ assert(sizeof(_ty1F) == sizeof(Word)); \ assert(sizeof(_ty2F) == sizeof(Word)); \ _arg1 = (Word)(_arg1F); \ @@ -106,7 +108,8 @@ _arg1,_arg2,0,0,0); \ } while (0) -#define DO_CREQ_W_WW(_resF, _creqF, _ty1F,_arg1F, _ty2F,_arg2F) \ +#define DO_CREQ_W_WW(_resF, _creqF, _ty1F,_arg1F, \ + _ty2F,_arg2F) \ do { \ Word _res, _arg1, _arg2; \ assert(sizeof(_ty1F) == sizeof(Word)); \ @@ -122,7 +125,8 @@ #define DO_CREQ_v_WWW(_creqF, _ty1F,_arg1F, \ _ty2F,_arg2F, _ty3F, _arg3F) \ do { \ - Word _unused_res, _arg1, _arg2, _arg3; \ + Word _unused_res __attribute__((unused)); \ + Word _arg1, _arg2, _arg3; \ assert(sizeof(_ty1F) == sizeof(Word)); \ assert(sizeof(_ty2F) == sizeof(Word)); \ assert(sizeof(_ty3F) == sizeof(Word)); \ diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c index ebef4d8e43..a06dea7a62 100644 --- a/memcheck/mc_replace_strmem.c +++ b/memcheck/mc_replace_strmem.c @@ -91,7 +91,7 @@ Bool is_overlap ( void* dst, const void* src, SizeT dstlen, SizeT srclen ) // extra function in the stack trace. #define RECORD_OVERLAP_ERROR(s, src, dst, len) \ { \ - Word unused_res; \ + Word unused_res __attribute__((unused)); \ VALGRIND_DO_CLIENT_REQUEST(unused_res, 0, \ _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR, \ s, src, dst, len, 0); \