From 8a1d2eb4cbd4a2776ccb2f41b3b5a27ba382853b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 1 Jun 2004 06:46:37 +0000 Subject: [PATCH] Fix some gcc 3.x compile warnings. --- ChangeLog | 5 +++++ jit/jit-cache.c | 2 +- jit/jit-elf-read.c | 17 +++++++++-------- tools/gen-apply.c | 12 ++++++++---- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1fe449..5259272 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ +2004-06-01 Rhys Weatherley + + * jit/jit-cache.c, jit/jit-elf-read.c, tools/gen-apply.c: + fix some gcc 3.x compile warnings. + 2004-05-31 Rhys Weatherley * jit/jit-rules-x86.sel: optimize multiplications for x86. diff --git a/jit/jit-cache.c b/jit/jit-cache.c index 251ccaa..4114bd7 100644 --- a/jit/jit-cache.c +++ b/jit/jit-cache.c @@ -114,7 +114,7 @@ static int CompressInt(unsigned char *buf, long data) buf[1] = (unsigned char)(data << 1); return 2; } - else if(data < (unsigned long)(1L << 28)) + else if(data < (long)(1L << 28)) { buf[0] = (unsigned char)((data >> 23) | 0xC0); buf[1] = (unsigned char)(data >> 15); diff --git a/jit/jit-elf-read.c b/jit/jit-elf-read.c index 944f66f..69a4d3a 100644 --- a/jit/jit-elf-read.c +++ b/jit/jit-elf-read.c @@ -428,9 +428,10 @@ failed_mmap: { segment_address = ((unsigned char *)base_address) + (jit_nuint)(phdr->p_vaddr); - if(lseek(fd, (off_t)(phdr->p_offset), 0) != phdr->p_offset || + if(lseek(fd, (off_t)(phdr->p_offset), 0) != + (off_t)(phdr->p_offset) || read(fd, segment_address, (size_t)(phdr->p_filesz)) - != (size_t)(phdr->p_filesz)) + != (int)(size_t)(phdr->p_filesz)) { jit_free_exec(base_address, memory_size); return 0; @@ -462,12 +463,12 @@ static void *map_section(int fd, Elf_Off offset, Elf_Xword file_size, { return 0; } - if(lseek(fd, offset, 0) != offset) + if(lseek(fd, (off_t)offset, 0) != (off_t)offset) { jit_free_exec(address, memory_size); return 0; } - if(read(fd, address, (size_t)file_size) != file_size) + if(read(fd, address, (size_t)file_size) != (int)(size_t)file_size) { jit_free_exec(address, memory_size); return 0; @@ -943,8 +944,8 @@ int jit_readelf_open(jit_readelf_t *_readelf, const char *filename, int flags) /* Seek to the program and section header tables and read them */ if(phdr_size > 0) { - if(lseek(fd, ehdr.e_phoff, 0) != ehdr.e_phoff || - read(fd, readelf->phdrs, phdr_size) != phdr_size) + if(lseek(fd, (off_t)(ehdr.e_phoff), 0) != (off_t)(ehdr.e_phoff) || + read(fd, readelf->phdrs, phdr_size) != (int)phdr_size) { jit_free(readelf->shdrs); jit_free(readelf->phdrs); @@ -955,8 +956,8 @@ int jit_readelf_open(jit_readelf_t *_readelf, const char *filename, int flags) } if(shdr_size > 0) { - if(lseek(fd, ehdr.e_shoff, 0) != ehdr.e_shoff || - read(fd, readelf->shdrs, shdr_size) != shdr_size) + if(lseek(fd, (off_t)(ehdr.e_shoff), 0) != (off_t)(ehdr.e_shoff) || + read(fd, readelf->shdrs, shdr_size) != (int)shdr_size) { jit_free(readelf->shdrs); jit_free(readelf->phdrs); diff --git a/tools/gen-apply.c b/tools/gen-apply.c index 8977b5f..f0da46e 100644 --- a/tools/gen-apply.c +++ b/tools/gen-apply.c @@ -948,7 +948,8 @@ void detect_reg_alignment_two_words(jit_int x, jit_long y, jit_long z) can_split_long = 0; align_long_regs = 1; } - else if(!mem_cmp(stack_args, ((jit_nint *)&y) + 1, sizeof(jit_nint))) + else if(!mem_cmp(stack_args, ((jit_nint *)(void *)&y) + 1, + sizeof(jit_nint))) { /* The long value was split between registers and the stack */ can_split_long = 1; @@ -965,7 +966,8 @@ void detect_reg_alignment_three_words(jit_int x, jit_long y, jit_long z) can_split_long = 0; align_long_regs = 1; } - else if(!mem_cmp(stack_args, ((jit_nint *)&y) + 1, sizeof(jit_nint))) + else if(!mem_cmp(stack_args, ((jit_nint *)(void *)&y) + 1, + sizeof(jit_nint))) { /* The long value was split between registers and the stack, so alignment has occurred, together with a split */ @@ -1022,7 +1024,8 @@ void detect_reg_split_even_words(jit_int x, jit_long y1, jit_long y2, case 19: value = y19; break; default: value = y20; break; } - if(!mem_cmp(stack_args, ((jit_nint *)&value) + 1, sizeof(jit_nint))) + if(!mem_cmp(stack_args, ((jit_nint *)(void *)&value) + 1, + sizeof(jit_nint))) { /* We've detected a register/stack split in this argument */ can_split_long = 1; @@ -1068,7 +1071,8 @@ void detect_reg_split_odd_words(jit_long y1, jit_long y2, case 19: value = y19; break; default: value = y20; break; } - if(!mem_cmp(stack_args, ((jit_nint *)&value) + 1, sizeof(jit_nint))) + if(!mem_cmp(stack_args, ((jit_nint *)(void *)&value) + 1, + sizeof(jit_nint))) { /* We've detected a register/stack split in this argument */ can_split_long = 1; -- 2.47.3