Browse Source

Fix some gcc 3.x compile warnings.

cache-refactoring
Rhys Weatherley 21 years ago
parent
commit
8a1d2eb4cb
  1. 5
      ChangeLog
  2. 2
      jit/jit-cache.c
  3. 17
      jit/jit-elf-read.c
  4. 12
      tools/gen-apply.c

5
ChangeLog

@ -1,4 +1,9 @@
2004-06-01 Rhys Weatherley <rweather@southern-storm.com.au>
* 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 <rweather@southern-storm.com.au>
* jit/jit-rules-x86.sel: optimize multiplications for x86.

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

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

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

Loading…
Cancel
Save