From: Bart Van Assche Date: Sun, 3 Apr 2011 17:42:19 +0000 (+0000) Subject: git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11682 X-Git-Tag: svn/VALGRIND_3_7_0~553 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a3e9fdd7cb8f51448f122660144c2aa47ae9c9e;p=thirdparty%2Fvalgrind.git git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11682 --- diff --git a/drd/tests/annotate_ignore_rw.c b/drd/tests/annotate_ignore_rw.c index f6a63b6583..75e9f98df1 100644 --- a/drd/tests/annotate_ignore_rw.c +++ b/drd/tests/annotate_ignore_rw.c @@ -24,7 +24,6 @@ int main(int argc, char** argv) { int optchar; int ign_rw = 1; - int tmp; pthread_t tid; while ((optchar = getopt(argc, argv, "r")) != EOF) @@ -54,7 +53,7 @@ int main(int argc, char** argv) sleep(1); /* Read s_c. */ - tmp = s_c; + fprintf(stderr, "x" + s_c); pthread_join(tid, 0); diff --git a/drd/tests/custom_alloc.c b/drd/tests/custom_alloc.c index 9faead5692..858155ef8b 100644 --- a/drd/tests/custom_alloc.c +++ b/drd/tests/custom_alloc.c @@ -57,7 +57,7 @@ static void custom_free(void* p) void make_leak(void) { - int* array2 = custom_alloc(sizeof(int) * 10); + int* array2 __attribute__((unused)) = custom_alloc(sizeof(int) * 10); array2 = 0; // leak return; } diff --git a/drd/tests/sigalrm.c b/drd/tests/sigalrm.c index 408eaf8cbc..38b979c560 100644 --- a/drd/tests/sigalrm.c +++ b/drd/tests/sigalrm.c @@ -55,7 +55,6 @@ void* thread_func(void* thread_arg) int main(int argc, char** argv) { - int vgthreadid; pthread_t threadid; struct timespec tsDelay; @@ -63,8 +62,6 @@ int main(int argc, char** argv) if (argc > 1) s_debug = 1; - vgthreadid = DRD_GET_VALGRIND_THREADID; - print_thread_id("main: "); { diff --git a/drd/tests/tsan_unittest.cpp b/drd/tests/tsan_unittest.cpp index 57357a3371..431a62280c 100644 --- a/drd/tests/tsan_unittest.cpp +++ b/drd/tests/tsan_unittest.cpp @@ -3469,7 +3469,7 @@ void Worker() { n %= Nlog; long t0 = clock(); - long t = t0; + long t __attribute__((unused)) = t0; for (int it = 0; it < N_iter; it++) { if(n == 0) { @@ -5047,7 +5047,7 @@ namespace test105 { int GLOB = 0; void F1() { - int ar[32]; + int ar[32] __attribute__((unused)); // ANNOTATE_TRACE_MEMORY(&ar[0]); // ANNOTATE_TRACE_MEMORY(&ar[31]); ar[0] = 1; @@ -5055,7 +5055,7 @@ void F1() { } void Worker() { - int ar[32]; + int ar[32] __attribute__((unused)); // ANNOTATE_TRACE_MEMORY(&ar[0]); // ANNOTATE_TRACE_MEMORY(&ar[31]); ar[0] = 1; diff --git a/exp-ptrcheck/tests/arith_include2.c b/exp-ptrcheck/tests/arith_include2.c index 2cc7e41cb0..524ca997f5 100644 --- a/exp-ptrcheck/tests/arith_include2.c +++ b/exp-ptrcheck/tests/arith_include2.c @@ -15,7 +15,7 @@ struct sigaction sigsegv; // Scratch values - long a, tn; + long a, tn __attribute__((unused)); long* tp; // Known pointers diff --git a/exp-ptrcheck/tests/hp_bounds.c b/exp-ptrcheck/tests/hp_bounds.c index c285e535ad..e456cabe8e 100644 --- a/exp-ptrcheck/tests/hp_bounds.c +++ b/exp-ptrcheck/tests/hp_bounds.c @@ -2,7 +2,7 @@ int main(void) { - int y; + int y __attribute__((unused)); int* x = malloc(sizeof(int) * 100); y = x[95]; // ok diff --git a/exp-ptrcheck/tests/hp_dangle.c b/exp-ptrcheck/tests/hp_dangle.c index 271e0ef601..31470df42f 100644 --- a/exp-ptrcheck/tests/hp_dangle.c +++ b/exp-ptrcheck/tests/hp_dangle.c @@ -11,7 +11,7 @@ int* mk_dangle(void) int main(void) { - int y; + int y __attribute__((unused)); int* x = mk_dangle(); y = x[5]; diff --git a/exp-ptrcheck/tests/justify.c b/exp-ptrcheck/tests/justify.c index 0cc5295a08..366c78ba36 100644 --- a/exp-ptrcheck/tests/justify.c +++ b/exp-ptrcheck/tests/justify.c @@ -10,7 +10,7 @@ int main ( void ) { - char c; + char c __attribute__((unused)); char *c0, *c1; c0 = malloc(10000); diff --git a/exp-ptrcheck/tests/mm.c b/exp-ptrcheck/tests/mm.c index 0f1a9bd241..0d78cf36af 100644 --- a/exp-ptrcheck/tests/mm.c +++ b/exp-ptrcheck/tests/mm.c @@ -15,7 +15,7 @@ int main(void) { struct sigaction sigsegv; - char c; + char c __attribute__((unused)); // This fails due to a bad fd (at one point I was not handling failing // mmap() calls, and would have got a seg fault). diff --git a/exp-ptrcheck/tests/partial.c b/exp-ptrcheck/tests/partial.c index 7bdc356482..2b2ee7fd3d 100644 --- a/exp-ptrcheck/tests/partial.c +++ b/exp-ptrcheck/tests/partial.c @@ -3,12 +3,17 @@ int main ( void ) { - int* x3 = malloc(3); float f, *f3 = malloc(3); - int* x4 = malloc(4); double d, *d7 = malloc(7); - int* x5 = malloc(5); long long int lli, *lli7 = malloc(7); - int* x6 = malloc(6); char c, *c0 = malloc(0); - int* x7 = malloc(7); short int s, *s1 = malloc(1); - int x; + int* x3 = malloc(3); + float f __attribute__((unused)), *f3 = malloc(3); + int* x4 = malloc(4); + double d __attribute__((unused)), *d7 = malloc(7); + int* x5 = malloc(5); + long long int lli __attribute__((unused)), *lli7 = malloc(7); + int* x6 = malloc(6); + char c __attribute__((unused)), *c0 = malloc(0); + int* x7 = malloc(7); + short int s __attribute__((unused)), *s1 = malloc(1); + int x __attribute__((unused)); int* y4 = malloc(4); int* y5 = malloc(5); int* y6 = malloc(6); diff --git a/exp-ptrcheck/tests/pth_specific.c b/exp-ptrcheck/tests/pth_specific.c index d679bb79af..9b8ca919d2 100644 --- a/exp-ptrcheck/tests/pth_specific.c +++ b/exp-ptrcheck/tests/pth_specific.c @@ -12,7 +12,7 @@ int main(void) { pthread_key_t key; char *x, *z; - char y; + char y __attribute__((unused)); x = malloc(100); diff --git a/exp-ptrcheck/tests/realloc.c b/exp-ptrcheck/tests/realloc.c index f588d536bb..8884664eb2 100644 --- a/exp-ptrcheck/tests/realloc.c +++ b/exp-ptrcheck/tests/realloc.c @@ -3,11 +3,11 @@ int main(void) { - int i; - int* y; + int i __attribute__((unused)); + int* y __attribute__((unused)); int** x = malloc(sizeof(int*) * 100); int* x2 = malloc(sizeof(int) * 100); - void* sink; + void* sink __attribute__((unused)); x[0] = x2; // this is to check the pointerness is copied across ok x[49] = x2; // this is to check the pointerness is copied across ok diff --git a/exp-ptrcheck/tests/strlen.c b/exp-ptrcheck/tests/strlen.c index 92b5c148a4..92abf46113 100644 --- a/exp-ptrcheck/tests/strlen.c +++ b/exp-ptrcheck/tests/strlen.c @@ -13,7 +13,7 @@ int main(void) char* h = "hello, world"; char* p = strdup(h); char u[20]; - char* c; + char* c __attribute__((unused)); int len; len = strlen(p); diff --git a/exp-ptrcheck/tests/unaligned.c b/exp-ptrcheck/tests/unaligned.c index 181e9176e1..6c7ba39d04 100644 --- a/exp-ptrcheck/tests/unaligned.c +++ b/exp-ptrcheck/tests/unaligned.c @@ -6,7 +6,7 @@ int main ( void ) { char* x = strdup("hello"); - char c; + char c __attribute__((unused)); char c0[8], c1[8], c2[8], c3[8], c4[8]; // Each of these pointers has a different alignment diff --git a/exp-ptrcheck/tests/zero.c b/exp-ptrcheck/tests/zero.c index adea4d6a1d..7077bb4462 100644 --- a/exp-ptrcheck/tests/zero.c +++ b/exp-ptrcheck/tests/zero.c @@ -5,7 +5,7 @@ int main ( void ) { - char c, *c0 = malloc(0), *c1; + char c __attribute__((unused)), *c0 = malloc(0), *c1; c = *c0; // bad diff --git a/helgrind/helgrind.h b/helgrind/helgrind.h index cbe09002eb..64271eddbb 100644 --- a/helgrind/helgrind.h +++ b/helgrind/helgrind.h @@ -144,7 +144,7 @@ typedef #define DO_CREQ_v_W(_creqF, _ty1F,_arg1F) \ do { \ - long int _unused_res, _arg1; \ + long _unused_res __attribute__((unused)), _arg1; \ /* assert(sizeof(_ty1F) == sizeof(long int)); */ \ _arg1 = (long int)(_arg1F); \ VALGRIND_DO_CLIENT_REQUEST(_unused_res, 0, \ @@ -165,7 +165,8 @@ typedef #define DO_CREQ_v_WW(_creqF, _ty1F,_arg1F, _ty2F,_arg2F) \ do { \ - long int _unused_res, _arg1, _arg2; \ + long _unused_res __attribute__((unused)); \ + long _arg1, _arg2; \ /* assert(sizeof(_ty1F) == sizeof(long int)); */ \ /* assert(sizeof(_ty2F) == sizeof(long int)); */ \ _arg1 = (long int)(_arg1F); \ @@ -178,7 +179,8 @@ typedef #define DO_CREQ_v_WWW(_creqF, _ty1F,_arg1F, \ _ty2F,_arg2F, _ty3F, _arg3F) \ do { \ - long int _unused_res, _arg1, _arg2, _arg3; \ + long _unused_res __attribute__((unused)); \ + long _arg1, _arg2, _arg3; \ /* assert(sizeof(_ty1F) == sizeof(long int)); */ \ /* assert(sizeof(_ty2F) == sizeof(long int)); */ \ /* assert(sizeof(_ty3F) == sizeof(long int)); */ \ diff --git a/helgrind/tests/tc18_semabuse.c b/helgrind/tests/tc18_semabuse.c index 40c068bdea..7395251ed8 100644 --- a/helgrind/tests/tc18_semabuse.c +++ b/helgrind/tests/tc18_semabuse.c @@ -16,7 +16,7 @@ void start_watchdog ( void ); int main ( void ) { - int r; + int r __attribute__((unused)); sem_t s1; start_watchdog(); /* Do sem_init with huge initial count */ diff --git a/massif/tests/realloc.c b/massif/tests/realloc.c index 9c772761b4..f6a37f8670 100644 --- a/massif/tests/realloc.c +++ b/massif/tests/realloc.c @@ -3,7 +3,7 @@ int main(void) { // All sizes are multiples of 16 -- no slop. int* x = realloc(NULL, 800); // equivalent to malloc(800), and ends up - int* y; // calling Valgrind's (and Massif's) malloc + int* y __attribute__((unused)); // calling Valgrind's (and Massif's) malloc x = realloc(x, 800); // same size diff --git a/memcheck/tests/error_counts.c b/memcheck/tests/error_counts.c index 5268cdbc0d..271dc9a438 100644 --- a/memcheck/tests/error_counts.c +++ b/memcheck/tests/error_counts.c @@ -8,9 +8,9 @@ int main(void) { int x; int y = 0; - int* reachable; + int* reachable __attribute__((unused)); int* dubious; - int* leaked; + int* leaked __attribute__((unused)); DECLARE_LEAK_COUNTERS; /* we require these longs to have same size as a machine word */ diff --git a/memcheck/tests/linux/brk.c b/memcheck/tests/linux/brk.c index 21bf84ec63..5ca054f866 100644 --- a/memcheck/tests/linux/brk.c +++ b/memcheck/tests/linux/brk.c @@ -12,7 +12,7 @@ int main(void) void* orig_ds = sbrk(0); void* ds = orig_ds; void* vals[10]; - void* res; + void* res __attribute__((unused)); #define EOL ((void*)( ~(long)0 )) vals[0] = (void*)0; vals[1] = (void*)1; diff --git a/memcheck/tests/linux/stack_switch.c b/memcheck/tests/linux/stack_switch.c index 1d179351dc..d54870dc79 100644 --- a/memcheck/tests/linux/stack_switch.c +++ b/memcheck/tests/linux/stack_switch.c @@ -32,7 +32,7 @@ static int thread_main(void *arg) int main(int argc, char **argv) { void *stack; - int stackid; + int stackid __attribute__((unused)); pid_t pid; /* "2*" is a ppc64-linux hack */ diff --git a/memcheck/tests/strchr.c b/memcheck/tests/strchr.c index 01aaef9d36..2c77f0903e 100644 --- a/memcheck/tests/strchr.c +++ b/memcheck/tests/strchr.c @@ -7,7 +7,7 @@ int main(int argc, char* argv[]) { - char *s, *a, *b; + char *s, *a __attribute__((unused)), *b __attribute__((unused)); s = malloc(sizeof(char)); // Nb: s[0] is uninitialised, but almost certainly a zero diff --git a/memcheck/tests/trivialleak.c b/memcheck/tests/trivialleak.c index f3a8963359..7ffcb8735c 100644 --- a/memcheck/tests/trivialleak.c +++ b/memcheck/tests/trivialleak.c @@ -2,7 +2,7 @@ static void test() { - void* leak; + void* leak __attribute__((unused)); int i; for (i = 0; i < 1000; i++) leak = (void*)malloc( 1 ); diff --git a/memcheck/tests/x86-linux/scalar_exit_group.c b/memcheck/tests/x86-linux/scalar_exit_group.c index 214d6c3df4..f843988b21 100644 --- a/memcheck/tests/x86-linux/scalar_exit_group.c +++ b/memcheck/tests/x86-linux/scalar_exit_group.c @@ -5,7 +5,7 @@ int main(void) // uninitialised, but we know px[0] is 0x0 long* px = malloc(sizeof(long)); long x0 = px[0]; - int res; + int res __attribute__((unused)); // All __NR_xxx numbers are taken from x86 diff --git a/memcheck/tests/x86-linux/scalar_fork.c b/memcheck/tests/x86-linux/scalar_fork.c index 805ade844c..914fdfbdb2 100644 --- a/memcheck/tests/x86-linux/scalar_fork.c +++ b/memcheck/tests/x86-linux/scalar_fork.c @@ -2,7 +2,7 @@ int main(void) { - int res; + int res __attribute__((unused)); // All __NR_xxx numbers are taken from x86 diff --git a/memcheck/tests/x86-linux/scalar_vfork.c b/memcheck/tests/x86-linux/scalar_vfork.c index fe999fb923..984c22edde 100644 --- a/memcheck/tests/x86-linux/scalar_vfork.c +++ b/memcheck/tests/x86-linux/scalar_vfork.c @@ -2,7 +2,7 @@ int main(void) { - int res; + int res __attribute__((unused)); // All __NR_xxx numbers are taken from x86 diff --git a/none/tests/bug129866.c b/none/tests/bug129866.c index abb8b2f0ee..da13aca87b 100644 --- a/none/tests/bug129866.c +++ b/none/tests/bug129866.c @@ -25,7 +25,7 @@ char * touch_realloc (char * ptr, int size) int main ( void ) { - char *a1, *b1, *a2, *b2; + char *a1, *b1, *a2 __attribute__((unused)), *b2 __attribute__((unused)); printf("started\n"); a1 = touch_malloc(1600000) ; b1 = touch_malloc(200000) ; diff --git a/none/tests/coolo_sigaction.cpp b/none/tests/coolo_sigaction.cpp index 2481746465..02aacd268f 100644 --- a/none/tests/coolo_sigaction.cpp +++ b/none/tests/coolo_sigaction.cpp @@ -42,12 +42,11 @@ int main() { int i; char buffer[200]; - size_t dummy_size_t; setupHandlers(); FILE *p = popen("echo Hallo World", "r"); while (!feof(p)) { int n = fread(buffer, 200, 1, p); - dummy_size_t = write(2, buffer, n); + write(2, buffer, n); } fclose(p); for (i = 0; i < 1000000; i++) ; diff --git a/none/tests/linux/mremap2.c b/none/tests/linux/mremap2.c index 76c2826241..b8ad068210 100644 --- a/none/tests/linux/mremap2.c +++ b/none/tests/linux/mremap2.c @@ -74,7 +74,7 @@ char* setup ( void* other_stuff, int other_len ) /* show the working area */ void show ( void ) { - int i,r; + int i,r __attribute__((unused)); for (i = 0; i < 200; i++) { r = mprotect( workingarea + i * PAGE, PAGE, PROT_NONE ); // We used to print 'X' or '.' according to the mprotect result, but the diff --git a/none/tests/x86/aad_aam.c b/none/tests/x86/aad_aam.c index 342044ac3e..f81140b093 100644 --- a/none/tests/x86/aad_aam.c +++ b/none/tests/x86/aad_aam.c @@ -18,7 +18,8 @@ int main(int argc, char **argv) { printf("test begins\n"); unsigned short i,out; unsigned int flags; - int cf,pf,af,zf,sf,of; + int cf __attribute__((unused)),pf,af __attribute__((unused)),zf,sf; + int of __attribute__((unused)); /* test AAM */ diff --git a/perf/sarp.c b/perf/sarp.c index 6265ad7245..ffb808d241 100644 --- a/perf/sarp.c +++ b/perf/sarp.c @@ -31,7 +31,7 @@ int main(void) { int i, sum = 0; - struct timespec req; + struct timespec req __attribute__((unused)); req.tv_sec = 0; req.tv_nsec = 100*1000*1000; // 0.1s diff --git a/perf/tinycc.c b/perf/tinycc.c index 51da47a859..42ff75fc5c 100644 --- a/perf/tinycc.c +++ b/perf/tinycc.c @@ -17975,7 +17975,8 @@ static void asm_instr(void) { CString astr, astr1; ASMOperand operands[MAX_ASM_OPERANDS]; - int nb_inputs, nb_outputs, nb_operands, i, must_subst, out_reg; + int nb_inputs __attribute__((unused)); + int nb_outputs, nb_operands, i, must_subst, out_reg; uint8_t clobber_regs[NB_ASM_REGS]; next(); @@ -18916,7 +18917,7 @@ static void put_got_entry(TCCState *s1, /* build GOT and PLT entries */ static void build_got_entries(TCCState *s1) { - Section *s, *symtab; + Section *s, *symtab __attribute__((unused)); Elf32_Rel *rel, *rel_end; Elf32_Sym *sym; int i, type, reloc_type, sym_index; @@ -20590,7 +20591,7 @@ static void rt_printline(unsigned long wanted_pc) static int rt_get_caller_pc(unsigned long *paddr, ucontext_t *uc, int level) { - unsigned long fp; + unsigned long fp __attribute__((unused)); //int i; if (level == 0) { @@ -20757,7 +20758,7 @@ TCCState *tcc_new(void) { const char *p, *r; TCCState *s; - TokenSym *ts; + TokenSym *ts __attribute__((unused)); int i, c; s = tcc_mallocz(sizeof(TCCState));