Appended patch gets rid of these two: cc -pipe -Os -Wall -Wstrict-prototypes -Wmissing-prototypes -Winline -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Winline -W -Wsign-compare -Wno-unused -I./include -DHAS_JIT -DI386 -o jit.o -c jit.c jit.c: In function `build_asm': jit.c:192: warning: cast discards qualifiers from pointer target type jit.c:195: warning: cast discards qualifiers from pointer target type
However, I'm not really convinced that it's quite the right way to do it. It more feels like a brute force splattering of "const" in a few places to make gcc shut up, rather than anything that adds to the readability or maintainability of the code. And not tested on alpha, because I don't have one. Nicholas Clark -- ENOCHOCOLATE http://www.ccl4.org/~nick/CV.html --- jit.c.orig Sun Jan 20 22:57:30 2002 +++ jit.c Sat Jan 26 21:36:32 2002 @@ -30,7 +30,8 @@ build_asm(struct Parrot_Interp *interpreter,opcode_t *pc, opcode_t *code_start, opcode_t *code_end) { char *arena, *arena_start; - INTVAL *address,ivalue,size,i,k; + const INTVAL *address; + INTVAL ivalue,size,i,k; INTVAL *op_address, prev_address, bytecode_position; #ifdef ALPHA char *interpreter_registers = ((char *)&interpreter->int_reg->registers[0]) + 0x7fff; @@ -189,10 +190,10 @@ address = (INTVAL *)&s->strlen; break; case 6: - address = (INTVAL *)s->encoding; + address = (const INTVAL *)s->encoding; break; case 7: - address = (INTVAL *)&s->type; + address = (const INTVAL *)&s->type; break; case 8: address = &s->language; @@ -322,11 +323,12 @@ ivalue = (INTVAL) (arena+v.info[i].position) + 4; if (address > (INTVAL *)ivalue) { - address = (INTVAL *)((char *)address - (char *)ivalue); + address = (const INTVAL *)((const char *)address + - (const char *)ivalue); } else if (address < (INTVAL *)ivalue) { - address = (INTVAL *) + address = (const INTVAL *) (-(arena - - (char *)address + + (const char *)address + op_assembly[*pc].size)); } else { address = 0; @@ -375,11 +377,12 @@ ivalue = (INTVAL) (arena+v.info[i].position) + 4; if (address > (INTVAL *)arena) { - address = (INTVAL *)((char *)address - (char *)ivalue); + address = (const INTVAL *)((const char *)address + - (const char *)ivalue); } else { - address = (INTVAL *) + address = (const INTVAL *) (-(arena - - (char *)address + + (const char *)address + v.info[i].position + 4)); } #ifdef ALPHA