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

This commit is contained in:
Bart Van Assche 2011-04-03 17:42:19 +00:00
parent 954dc6c188
commit 8a3e9fdd7c
32 changed files with 55 additions and 51 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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: ");
{

View File

@ -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;

View File

@ -15,7 +15,7 @@
struct sigaction sigsegv;
// Scratch values
long a, tn;
long a, tn __attribute__((unused));
long* tp;
// Known pointers

View File

@ -2,7 +2,7 @@
int main(void)
{
int y;
int y __attribute__((unused));
int* x = malloc(sizeof(int) * 100);
y = x[95]; // ok

View File

@ -11,7 +11,7 @@ int* mk_dangle(void)
int main(void)
{
int y;
int y __attribute__((unused));
int* x = mk_dangle();
y = x[5];

View File

@ -10,7 +10,7 @@
int main ( void )
{
char c;
char c __attribute__((unused));
char *c0, *c1;
c0 = malloc(10000);

View File

@ -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).

View File

@ -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);

View File

@ -12,7 +12,7 @@ int main(void)
{
pthread_key_t key;
char *x, *z;
char y;
char y __attribute__((unused));
x = malloc(100);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -5,7 +5,7 @@
int main ( void )
{
char c, *c0 = malloc(0), *c1;
char c __attribute__((unused)), *c0 = malloc(0), *c1;
c = *c0; // bad

View File

@ -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)); */ \

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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 );

View File

@ -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

View File

@ -2,7 +2,7 @@
int main(void)
{
int res;
int res __attribute__((unused));
// All __NR_xxx numbers are taken from x86

View File

@ -2,7 +2,7 @@
int main(void)
{
int res;
int res __attribute__((unused));
// All __NR_xxx numbers are taken from x86

View File

@ -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) ;

View File

@ -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++) ;

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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));