Skip to content

Commit 06f0713

Browse files
rilliangraydon
authored andcommitted
Mark valgrind's _qzz_res as unused to silence warnings on gcc 4.6.
This applies c11675 by Julian Seward from valgrind trunk (svn://svn.valgrind.org/valgrind/trunk) to rustrt's included copies of memcheck.h and valgrind.h, effectively backporting the fix from the unreleased 3.6.2. The commit simply applies the gcc 'unused' attribute to the relevant declarations. This change allows compilation of the runtime code under gcc 4.6 with -Werror, as the makefile currently requests.
1 parent fea6232 commit 06f0713

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

Diff for: src/rt/memcheck.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ typedef
184184

185185
/* Do a full memory leak check (like --leak-check=full) mid-execution. */
186186
#define VALGRIND_DO_LEAK_CHECK \
187-
{unsigned long _qzz_res; \
187+
{unsigned long _qzz_res __attribute((unused)); \
188188
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
189189
VG_USERREQ__DO_LEAK_CHECK, \
190190
0, 0, 0, 0, 0); \
191191
}
192192

193193
/* Do a summary memory leak check (like --leak-check=summary) mid-execution. */
194194
#define VALGRIND_DO_QUICK_LEAK_CHECK \
195-
{unsigned long _qzz_res; \
195+
{unsigned long _qzz_res __attribute((unused)); \
196196
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
197197
VG_USERREQ__DO_LEAK_CHECK, \
198198
1, 0, 0, 0, 0); \
@@ -207,7 +207,7 @@ typedef
207207
are. We also initialise '_qzz_leaked', etc because
208208
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
209209
defined. */ \
210-
{unsigned long _qzz_res; \
210+
{unsigned long _qzz_res __attribute((unused)); \
211211
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
212212
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
213213
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
@@ -229,7 +229,7 @@ typedef
229229
are. We also initialise '_qzz_leaked', etc because
230230
VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
231231
defined. */ \
232-
{unsigned long _qzz_res; \
232+
{unsigned long _qzz_res __attribute((unused)); \
233233
unsigned long _qzz_leaked = 0, _qzz_dubious = 0; \
234234
unsigned long _qzz_reachable = 0, _qzz_suppressed = 0; \
235235
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \

Diff for: src/rt/valgrind.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -4403,7 +4403,7 @@ vg_VALGRIND_DO_CLIENT_REQUEST_EXPR(uintptr_t _zzq_default,
44034403
since it provides a way to make sure valgrind will retranslate the
44044404
invalidated area. Returns no value. */
44054405
#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
4406-
{unsigned int _qzz_res; \
4406+
{unsigned int _qzz_res __attribute((unused)); \
44074407
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
44084408
VG_USERREQ__DISCARD_TRANSLATIONS, \
44094409
_qzz_addr, _qzz_len, 0, 0, 0); \
@@ -4652,7 +4652,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
46524652
Ignored if addr == 0.
46534653
*/
46544654
#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
4655-
{unsigned int _qzz_res; \
4655+
{unsigned int _qzz_res __attribute((unused)); \
46564656
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46574657
VG_USERREQ__MALLOCLIKE_BLOCK, \
46584658
addr, sizeB, rzB, is_zeroed, 0); \
@@ -4662,63 +4662,63 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
46624662
Ignored if addr == 0.
46634663
*/
46644664
#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
4665-
{unsigned int _qzz_res; \
4665+
{unsigned int _qzz_res __attribute((unused)); \
46664666
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46674667
VG_USERREQ__FREELIKE_BLOCK, \
46684668
addr, rzB, 0, 0, 0); \
46694669
}
46704670

46714671
/* Create a memory pool. */
46724672
#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
4673-
{unsigned int _qzz_res; \
4673+
{unsigned int _qzz_res __attribute((unused)); \
46744674
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46754675
VG_USERREQ__CREATE_MEMPOOL, \
46764676
pool, rzB, is_zeroed, 0, 0); \
46774677
}
46784678

46794679
/* Destroy a memory pool. */
46804680
#define VALGRIND_DESTROY_MEMPOOL(pool) \
4681-
{unsigned int _qzz_res; \
4681+
{unsigned int _qzz_res __attribute((unused)); \
46824682
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46834683
VG_USERREQ__DESTROY_MEMPOOL, \
46844684
pool, 0, 0, 0, 0); \
46854685
}
46864686

46874687
/* Associate a piece of memory with a memory pool. */
46884688
#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
4689-
{unsigned int _qzz_res; \
4689+
{unsigned int _qzz_res __attribute((unused)); \
46904690
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46914691
VG_USERREQ__MEMPOOL_ALLOC, \
46924692
pool, addr, size, 0, 0); \
46934693
}
46944694

46954695
/* Disassociate a piece of memory from a memory pool. */
46964696
#define VALGRIND_MEMPOOL_FREE(pool, addr) \
4697-
{unsigned int _qzz_res; \
4697+
{unsigned int _qzz_res __attribute((unused)); \
46984698
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
46994699
VG_USERREQ__MEMPOOL_FREE, \
47004700
pool, addr, 0, 0, 0); \
47014701
}
47024702

47034703
/* Disassociate any pieces outside a particular range. */
47044704
#define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
4705-
{unsigned int _qzz_res; \
4705+
{unsigned int _qzz_res __attribute((unused)); \
47064706
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47074707
VG_USERREQ__MEMPOOL_TRIM, \
47084708
pool, addr, size, 0, 0); \
47094709
}
47104710

47114711
/* Resize and/or move a piece associated with a memory pool. */
47124712
#define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
4713-
{unsigned int _qzz_res; \
4713+
{unsigned int _qzz_res __attribute((unused)); \
47144714
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47154715
VG_USERREQ__MOVE_MEMPOOL, \
47164716
poolA, poolB, 0, 0, 0); \
47174717
}
47184718

47194719
/* Resize and/or move a piece associated with a memory pool. */
47204720
#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
4721-
{unsigned int _qzz_res; \
4721+
{unsigned int _qzz_res __attribute((unused)); \
47224722
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47234723
VG_USERREQ__MEMPOOL_CHANGE, \
47244724
pool, addrA, addrB, size, 0); \
@@ -4747,23 +4747,23 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
47474747
/* Unmark the piece of memory associated with a stack id as being a
47484748
stack. */
47494749
#define VALGRIND_STACK_DEREGISTER(id) \
4750-
{unsigned int _qzz_res; \
4750+
{unsigned int _qzz_res __attribute((unused)); \
47514751
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47524752
VG_USERREQ__STACK_DEREGISTER, \
47534753
id, 0, 0, 0, 0); \
47544754
}
47554755

47564756
/* Change the start and end address of the stack id. */
47574757
#define VALGRIND_STACK_CHANGE(id, start, end) \
4758-
{unsigned int _qzz_res; \
4758+
{unsigned int _qzz_res __attribute((unused)); \
47594759
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47604760
VG_USERREQ__STACK_CHANGE, \
47614761
id, start, end, 0, 0); \
47624762
}
47634763

47644764
/* Load PDB debug info for Wine PE image_map. */
47654765
#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \
4766-
{unsigned int _qzz_res; \
4766+
{unsigned int _qzz_res __attribute((unused)); \
47674767
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47684768
VG_USERREQ__LOAD_PDB_DEBUGINFO, \
47694769
fd, ptr, total_size, delta, 0); \
@@ -4774,7 +4774,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
47744774
result will be dumped in there and is guaranteed to be zero
47754775
terminated. If no info is found, the first byte is set to zero. */
47764776
#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \
4777-
{unsigned int _qzz_res; \
4777+
{unsigned int _qzz_res __attribute((unused)); \
47784778
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
47794779
VG_USERREQ__MAP_IP_TO_SRCLOC, \
47804780
addr, buf64, 0, 0, 0); \

0 commit comments

Comments
 (0)