From: Julian Seward Date: Mon, 28 Mar 2011 21:19:00 +0000 (+0000) Subject: Remove a bunch more warnings generated by gcc-4.6 about dead X-Git-Tag: svn/VALGRIND_3_7_0~559 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8a03bdc8e7c8f07405f92340d0e80e1bfe83a71;p=thirdparty%2Fvalgrind.git Remove a bunch more warnings generated by gcc-4.6 about dead assignments ("[-Wunused-but-set-variable]"), in the test suite. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11675 --- diff --git a/callgrind/callgrind.h b/callgrind/callgrind.h index d36b6f4eb7..3879a16542 100644 --- a/callgrind/callgrind.h +++ b/callgrind/callgrind.h @@ -83,7 +83,7 @@ typedef /* Dump current state of cost centers, and zero them afterwards */ #define CALLGRIND_DUMP_STATS \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DUMP_STATS, \ 0, 0, 0, 0, 0); \ @@ -94,7 +94,7 @@ typedef the dump. This string is written as a description field into the profile data dump. */ #define CALLGRIND_DUMP_STATS_AT(pos_str) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DUMP_STATS_AT, \ pos_str, 0, 0, 0, 0); \ @@ -102,7 +102,7 @@ typedef /* Zero cost centers */ #define CALLGRIND_ZERO_STATS \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__ZERO_STATS, \ 0, 0, 0, 0, 0); \ @@ -113,7 +113,7 @@ typedef should be noted or if they are to be ignored. Events are noted by increment of counters in a cost center */ #define CALLGRIND_TOGGLE_COLLECT \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__TOGGLE_COLLECT, \ 0, 0, 0, 0, 0); \ @@ -124,7 +124,7 @@ typedef this will lead to an artifical cache warmup phase afterwards with cache misses which would not have happened in reality. */ #define CALLGRIND_START_INSTRUMENTATION \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__START_INSTRUMENTATION, \ 0, 0, 0, 0, 0); \ @@ -138,7 +138,7 @@ typedef To start Callgrind in this mode to ignore the setup phase, use the option "--instr-atstart=no". */ #define CALLGRIND_STOP_INSTRUMENTATION \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__STOP_INSTRUMENTATION, \ 0, 0, 0, 0, 0); \ diff --git a/include/valgrind.h b/include/valgrind.h index 75441bcac1..8933e0f0f7 100644 --- a/include/valgrind.h +++ b/include/valgrind.h @@ -4955,7 +4955,7 @@ vg_VALGRIND_DO_CLIENT_REQUEST_EXPR(uintptr_t _zzq_default, since it provides a way to make sure valgrind will retranslate the invalidated area. Returns no value. */ #define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DISCARD_TRANSLATIONS, \ _qzz_addr, _qzz_len, 0, 0, 0); \ @@ -5217,7 +5217,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) Ignored if addr == 0. */ #define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MALLOCLIKE_BLOCK, \ addr, sizeB, rzB, is_zeroed, 0); \ @@ -5226,10 +5226,10 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details. Ignored if addr == 0. */ -#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB)\ - {unsigned int _qzz_res; \ +#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ - VG_USERREQ__RESIZEINPLACE_BLOCK, \ + VG_USERREQ__RESIZEINPLACE_BLOCK, \ addr, oldSizeB, newSizeB, rzB, 0); \ } @@ -5237,7 +5237,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) Ignored if addr == 0. */ #define VALGRIND_FREELIKE_BLOCK(addr, rzB) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__FREELIKE_BLOCK, \ addr, rzB, 0, 0, 0); \ @@ -5245,7 +5245,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Create a memory pool. */ #define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__CREATE_MEMPOOL, \ pool, rzB, is_zeroed, 0, 0); \ @@ -5253,7 +5253,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Destroy a memory pool. */ #define VALGRIND_DESTROY_MEMPOOL(pool) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DESTROY_MEMPOOL, \ pool, 0, 0, 0, 0); \ @@ -5261,7 +5261,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Associate a piece of memory with a memory pool. */ #define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MEMPOOL_ALLOC, \ pool, addr, size, 0, 0); \ @@ -5269,7 +5269,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Disassociate a piece of memory from a memory pool. */ #define VALGRIND_MEMPOOL_FREE(pool, addr) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MEMPOOL_FREE, \ pool, addr, 0, 0, 0); \ @@ -5277,7 +5277,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Disassociate any pieces outside a particular range. */ #define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MEMPOOL_TRIM, \ pool, addr, size, 0, 0); \ @@ -5285,7 +5285,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Resize and/or move a piece associated with a memory pool. */ #define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MOVE_MEMPOOL, \ poolA, poolB, 0, 0, 0); \ @@ -5293,7 +5293,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Resize and/or move a piece associated with a memory pool. */ #define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MEMPOOL_CHANGE, \ pool, addrA, addrB, size, 0); \ @@ -5322,7 +5322,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Unmark the piece of memory associated with a stack id as being a stack. */ #define VALGRIND_STACK_DEREGISTER(id) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__STACK_DEREGISTER, \ id, 0, 0, 0, 0); \ @@ -5330,7 +5330,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Change the start and end address of the stack id. */ #define VALGRIND_STACK_CHANGE(id, start, end) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__STACK_CHANGE, \ id, start, end, 0, 0); \ @@ -5338,7 +5338,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* Load PDB debug info for Wine PE image_map. */ #define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__LOAD_PDB_DEBUGINFO, \ fd, ptr, total_size, delta, 0); \ @@ -5349,7 +5349,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) result will be dumped in there and is guaranteed to be zero terminated. If no info is found, the first byte is set to zero. */ #define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \ - {unsigned int _qzz_res; \ + {unsigned int _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__MAP_IP_TO_SRCLOC, \ addr, buf64, 0, 0, 0); \ diff --git a/memcheck/memcheck.h b/memcheck/memcheck.h index f59c21223a..77629705a4 100644 --- a/memcheck/memcheck.h +++ b/memcheck/memcheck.h @@ -184,7 +184,7 @@ typedef /* Do a full memory leak check (like --leak-check=full) mid-execution. */ #define VALGRIND_DO_LEAK_CHECK \ - {unsigned long _qzz_res; \ + {unsigned long _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DO_LEAK_CHECK, \ 0, 0, 0, 0, 0); \ @@ -192,7 +192,7 @@ typedef /* Do a summary memory leak check (like --leak-check=summary) mid-execution. */ #define VALGRIND_DO_QUICK_LEAK_CHECK \ - {unsigned long _qzz_res; \ + {unsigned long _qzz_res __attribute((unused)); \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ VG_USERREQ__DO_LEAK_CHECK, \ 1, 0, 0, 0, 0); \ @@ -207,7 +207,7 @@ typedef are. We also initialise '_qzz_leaked', etc because VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as defined. */ \ - {unsigned long _qzz_res; \ + {unsigned long _qzz_res __attribute((unused)); \ unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \ unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ @@ -229,7 +229,7 @@ typedef are. We also initialise '_qzz_leaked', etc because VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as defined. */ \ - {unsigned long _qzz_res; \ + {unsigned long _qzz_res __attribute((unused)); \ unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \ unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ diff --git a/memcheck/tests/custom_alloc.c b/memcheck/tests/custom_alloc.c index 13bf12a2aa..2f91c6fe87 100644 --- a/memcheck/tests/custom_alloc.c +++ b/memcheck/tests/custom_alloc.c @@ -63,7 +63,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; }