]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix up most but not all warnings generated by gcc-4.6 about
authorJulian Seward <jseward@acm.org>
Mon, 28 Mar 2011 16:26:42 +0000 (16:26 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 28 Mar 2011 16:26:42 +0000 (16:26 +0000)
dead assignments ("[-Wunused-but-set-variable]").

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11673

18 files changed:
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/readdwarf.c
coregrind/m_debuginfo/readpdb.c
coregrind/m_debuginfo/readstabs.c
coregrind/m_debuglog.c
coregrind/m_libcprint.c
coregrind/m_machine.c
coregrind/m_main.c
coregrind/m_replacemalloc/vg_replace_malloc.c
coregrind/m_signals.c
coregrind/m_translate.c
coregrind/m_ume/elf.c
coregrind/vg_preloaded.c
drd/drd_pthread_intercepts.c
drd/drd_qtcore_intercepts.c
exp-dhat/dh_main.c
helgrind/hg_intercepts.c
memcheck/mc_replace_strmem.c

index e59b228629a9b45f4f3e3379c05a9b459558a5c9..4aa9286dd0bddd6e05bfc566880b8b47a0d76dbf 100644 (file)
@@ -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--) {
index 5f1d2cea4e74ad76ec0df29c6b5a3167969f4ff9..4e93bb258491d61be6777fdf243e71211a93cd50 100644 (file)
@@ -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 */
index f612a08777d6d8756cebb19fa5e60e45bfc952d5..8a8fc7f3b7e226d24fb44fb959ae787183b105f9 100644 (file)
@@ -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;
       }
index e91faf42a9d80b8276d458e9f185f8fa9d64556a..6d0079707507a35ff73e782c39ff39b66992e5ff 100644 (file)
@@ -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 */
index 5ec7a90f75907e385fb673c1daa170aec6e10d3e..257d9468483d8f4b236483d48de761c36b3394cf 100644 (file)
@@ -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) );
index 389fd4c18c81a86b5036436377ce9d2b321604b0..dee9e56653237364d2f48bde62ac50fc132a5cd1 100644 (file)
@@ -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;
 }
index d832d307d2d178d773cb524f64845bda2bba8de6..042d98513afff0a3a86f1597d1d4f118b3ddbbe4 100644 (file)
@@ -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
index acfcdda78f60f4ecdbca8437e2cf6d543a91d15f..e9bfe20906da5410bdce22e3918f2f645c64067d 100644 (file)
@@ -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++) {
index 95756d24e0d17efb6ca409654375fb4ce4147d56..9d2cb44fbb841810dd9550d12ce055eaa962376b 100644 (file)
@@ -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:
    //   
index 417176209f0efa83db6e8ea3736b9851f9e5a385..65fc40a051aa73f5bffdb309fbd51f5029e4d4df 100644 (file)
@@ -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);
index 864f38d358da56adc31c8272bfb2dcfdb3445b6e..fae4854fbee2ec7edb4382ba5ecbdee884d381d7 100644 (file)
@@ -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 );
index 39e6f0b5a52cbee858bcc3b00a91caa3b733a4c9..678d16fee20f1cc226d6882d736cbdc197725916 100644 (file)
@@ -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);
index f74b52af925e5b88a53ac4454712536abf1f72dd..863c7743fa525008fd651b5e97379edfd7b02fa5 100644 (file)
@@ -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);
index 43cd63748e8112eb63b023605164a0afd7751d52..3c9f039c1e78d68b493097a4403defff86495181 100644 (file)
@@ -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,
index e040d08812ae6716d69209374aff34956dd99171..be1c5c9a9da574e5e9f9eaa925018beba261f772 100644 (file)
@@ -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,
index 82eb941b7b3756fc7a3b0ac2e7dd983d03f91e68..810a289a3b6a8f9d7123410796bb9cbfdc02b7c2 100644 (file)
@@ -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
index 01e6ab27c5b282157948a21142b310c505a182d0..a31dc0da449f09f64afd524c242371732175a326 100644 (file)
@@ -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);                            \
                                  _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));             \
 #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));             \
index ebef4d8e43fc0716c23186dd8f544cbec4528f8b..a06dea7a626343e494e5e16d219f810559fc6a57 100644 (file)
@@ -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); \