If I've got this right, then this patch silences all warnings about unused variables, except for those from the ops files.
This may not be the preferred way to do it, but it does flag where all the unused parameters currently are. Nicholas Clark --- include/parrot/parrot.h~ Sat Dec 15 14:21:03 2001 +++ include/parrot/parrot.h Mon Jan 7 21:56:40 2002 @@ -68,6 +68,11 @@ typedef void* BIGINT; typedef void* BIGFLOAT; +/* define a macro to acknowledge an unused argument, and silence a "helpful" + compiler warning. gcc will emit a warning on an empty if body unless {} is + used to make an empty block. */ +#define UNUSED(a) if (0 || a) {} + #include "parrot/global_setup.h" #include "parrot/interpreter.h" #include "parrot/encoding.h" --- ./encodings/singlebyte.c.orig Tue Jan 1 20:35:56 2002 +++ ./encodings/singlebyte.c Mon Jan 7 22:34:07 2002 @@ -16,6 +16,8 @@ static UINTVAL singlebyte_characters (const void *ptr, UINTVAL bytes) { + UNUSED (ptr); + return bytes; } --- ./encodings/utf32.c.orig Tue Jan 1 20:35:56 2002 +++ ./encodings/utf32.c Mon Jan 7 22:36:01 2002 @@ -19,6 +19,8 @@ static UINTVAL utf32_characters (const void *ptr, UINTVAL bytes) { + UNUSED (ptr); + return bytes / 4; } --- ./io/io.c.orig Fri Jan 4 00:22:45 2002 +++ ./io/io.c Mon Jan 7 22:25:58 2002 @@ -55,6 +55,9 @@ ParrotIO * PIO_new(theINTERP, ParrotIO * old, INTVAL iotype, INTVAL flags, INTVAL mode) { ParrotIO * new_io; + + UNUSED (interpreter); UNUSED (iotype); + if( old ) { /* FIXME: Reuse old IO */ } @@ -109,6 +112,7 @@ * IO system destructor, flush streams, free structures, etc. */ void PIO_atexit(theINTERP) { + UNUSED (interpreter); #if 0 PIO_flush(interpreter, pio_stdout); #endif @@ -148,6 +152,7 @@ * time. This is similar to a Perl module INIT {} block. */ INTVAL PIO_base_init(theINTERP, ParrotIOLayer * l) { + UNUSED (interpreter); UNUSED (l); return 0; } --- ./io/io_os.c.orig Fri Jan 4 00:22:45 2002 +++ ./io/io_os.c Mon Jan 7 22:30:32 2002 @@ -64,6 +64,9 @@ flags = 0; mode = DEFAULT_OPEN_MODE; modeptr = smode; + + UNUSED (layer); + #if 0 if((interpreter->flags & PARROT_DEBUG_FLAG) != 0) { fprintf(stderr, "PIO_os_open: %s, %s\n", @@ -169,6 +172,7 @@ flags = 0; mode = 0; + UNUSED (layer); UNUSED (smode); /* FIXME - Check file handle specifics, validity */ /* Need to make this portable, I haven't checked this * on non-UNIX. @@ -199,6 +203,7 @@ INTVAL PIO_os_close(theINTERP, ParrotIOLayer * layer, ParrotIO * io) { + UNUSED (interpreter); UNUSED (layer); #if 0 if((interpreter->flags & PARROT_DEBUG_FLAG) != 0) { fprintf(stderr, "PIO_os_close: %d\n", (int)io->fd ); @@ -215,6 +220,7 @@ * Can also be accomplished by O_SYNC on file handle. */ void PIO_os_flush(theINTERP, ParrotIOLayer * layer, ParrotIO * io) { + UNUSED (interpreter); UNUSED (layer); UNUSED (io); #if 0 /* UNIX and VMS have fsync, does win32? */ fsync(io->fd); @@ -225,6 +231,9 @@ size_t PIO_os_read(theINTERP, ParrotIOLayer * layer, ParrotIO * io, void * buffer, size_t len) { int bytes; + + UNUSED (interpreter); UNUSED (layer); + for(;;) { bytes = read(io->fd, buffer, len); if( bytes > 0 ) @@ -249,6 +258,9 @@ size_t bytes; size_t to_write; const char * ptr; + + UNUSED (interpreter); UNUSED (layer); + #if 0 if((interpreter->flags & PARROT_DEBUG_FLAG) != 0) { fprintf(stderr, "ParrotIO_os_write(fd=%d): %d bytes\n", --- ./io/io_stdio.c.orig Fri Jan 4 16:54:33 2002 +++ ./io/io_stdio.c Mon Jan 7 22:32:48 2002 @@ -84,6 +84,7 @@ size_t size; ParrotIOLayer * l = layer; ParrotIOBuf * b = &io->b; + UNUSED (size); /* If there is a buffer, make sure we flush before * dinking around with the buffer. */ @@ -158,6 +159,7 @@ void PIO_stdio_flush(theINTERP, ParrotIOLayer * layer, ParrotIO * io) { + UNUSED (interpreter); UNUSED (layer); UNUSED (io); #if 0 size_t err; size_t to_write; @@ -194,12 +196,16 @@ size_t PIO_stdio_read(theINTERP, ParrotIOLayer * layer, ParrotIO * io, void * buffer, size_t len) { + UNUSED (interpreter); UNUSED (layer); UNUSED (io); + UNUSED (buffer); UNUSED (len); return 0; } size_t PIO_stdio_write(theINTERP, ParrotIOLayer * layer, ParrotIO * io, const void * buffer, size_t len) { + UNUSED (interpreter); UNUSED (layer); UNUSED (io); + UNUSED (buffer); UNUSED (len); return 0; } --- ./register.c.orig Mon Dec 31 00:15:28 2001 +++ ./register.c Mon Jan 7 21:54:50 2002 @@ -427,6 +427,7 @@ */ void Parrot_push_on_stack(void *thing, INTVAL size, INTVAL type) { + UNUSED (thing); UNUSED (size); UNUSED (type); } /*=for api register Parrot_pop_off_stack @@ -434,6 +435,7 @@ */ void Parrot_pop_off_stack(void *thing, INTVAL type) { + UNUSED (thing); UNUSED (type); } /* --- ./interpreter.c.orig Sun Jan 6 08:33:01 2002 +++ ./interpreter.c Mon Jan 7 21:58:39 2002 @@ -26,7 +26,7 @@ static void check_fingerprint(struct Parrot_Interp *interpreter) { /* if (PNCONST == 0) { */ - + UNUSED (interpreter); return; #if 0 @@ -100,6 +100,8 @@ { char file_name[50]; char func_name[50]; + + UNUSED (interpreter); sprintf(file_name, "lib%s_prederef.so.%s", PARROT_CORE_OPLIB_NAME, PARROT_VERSION); --- ./memory.c.orig Tue Jan 1 18:09:19 2002 +++ ./memory.c Mon Jan 7 22:11:57 2002 @@ -77,6 +77,7 @@ */ void mem_setup_allocator(struct Parrot_Interp *interpreter) { + UNUSED (interpreter); } /* --- ./key.c.orig Mon Jan 7 20:46:36 2002 +++ ./key.c Mon Jan 7 22:22:50 2002 @@ -26,6 +26,8 @@ INTVAL len = value->buflen; INTVAL hash = 5893; + UNUSED (interpreter); + while(len--) { hash = hash * 33 + *buffptr++; } @@ -42,6 +44,9 @@ KEY* key_new(struct Parrot_Interp *interpreter) { KEY* key = mem_sys_allocate(sizeof(KEY)); + + UNUSED (interpreter); + key->size = 0; return key; } @@ -73,6 +78,8 @@ */ INTVAL key_size(struct Parrot_Interp *interpreter, KEY* key) { + UNUSED (interpreter); + if(key != NULL) { return key->size; } @@ -90,6 +97,8 @@ */ void key_set_size(struct Parrot_Interp *interpreter, KEY* key, INTVAL size) { + UNUSED (interpreter); + if(key != NULL) { if(size < 0) { fprintf(stderr,"*** key_set_size asked to resize below zero\n"); @@ -126,6 +135,8 @@ */ void key_destroy(struct Parrot_Interp *interpreter, KEY* key) { + UNUSED (interpreter); + if(key != NULL) { INTVAL i; for(i=0;i<key->size;i++) { @@ -147,6 +158,8 @@ INTVAL key_element_type(struct Parrot_Interp *interpreter, KEY* key, INTVAL idx) { + UNUSED (interpreter); + if(key != NULL) { if((idx >= 0) || (idx < key->size)) { KEY_PAIR* pair = &key->keys[idx]; @@ -170,6 +183,8 @@ KEY_PAIR* key_element_value_i(struct Parrot_Interp *interpreter, KEY* key, INTVAL idx) { + UNUSED (interpreter); + if(key != NULL) { if((idx >= 0) || (idx < key->size)) { KEY_PAIR* pair = &key->keys[idx]; @@ -214,6 +229,8 @@ void key_set_element_value_i(struct Parrot_Interp *interpreter, KEY* key, INTVAL idx, KEY_PAIR* value) { + UNUSED (interpreter); + if(key != NULL) { if((idx >= 0) || (idx < key->size)) { memcpy(&key->keys[idx],value,sizeof(KEY_PAIR)); @@ -255,6 +272,8 @@ */ void key_chop(struct Parrot_Interp *interpreter, KEY* key) { + UNUSED (interpreter); + if(key != NULL) { if(key->size > 0) { /* Memory leak in the making */ @@ -283,6 +302,8 @@ */ void key_inc(struct Parrot_Interp *interpreter, KEY* key, INTVAL idx) { + UNUSED (interpreter); + if(key != NULL) { if(idx > 0 && idx <= key->size) { KEY_PAIR* pair = &key->keys[idx]; --- ./packfile.c.orig Mon Jan 7 20:48:21 2002 +++ ./packfile.c Mon Jan 7 22:14:11 2002 @@ -649,6 +649,7 @@ opcode_t PackFile_FixupTable_unpack(struct PackFile_FixupTable * self, char * packed, opcode_t packed_size) { + UNUSED (self); UNUSED (packed); UNUSED (packed_size); return 1; } @@ -666,6 +667,7 @@ opcode_t PackFile_FixupTable_pack_size(struct PackFile_FixupTable * self) { + UNUSED (self); return 0; } @@ -684,6 +686,7 @@ void PackFile_FixupTable_pack(struct PackFile_FixupTable * self, char * packed) { + UNUSED (self); UNUSED (packed); return; } @@ -700,6 +703,7 @@ void PackFile_FixupTable_dump(struct PackFile_FixupTable * self) { + UNUSED (self); return; } @@ -1283,6 +1287,8 @@ opcode_t type; opcode_t size; + UNUSED (packed_size); + if (!self) { return 0; } @@ -1360,6 +1366,8 @@ char * cursor; opcode_t value; + UNUSED (packed_size); + if (!self) { return 0; } @@ -1401,6 +1409,8 @@ char * cursor; FLOATVAL value; + UNUSED (packed_size); + if (!self) { return 0; } @@ -1448,6 +1458,8 @@ opcode_t encoding; opcode_t type; size_t size; + + UNUSED (packed_size); if (!self) { return 0; --- ./stacks.c.orig Fri Jan 4 10:32:47 2002 +++ ./stacks.c Mon Jan 7 22:16:36 2002 @@ -14,6 +14,8 @@ void new_stack(struct Parrot_Interp *interpreter, struct StackChunk **base, struct Stack_Entry **top) { + UNUSED (interpreter); + (*base)=mem_allocate_aligned(sizeof(struct StackChunk)); (*top)=&((*base)->entry[0]); @@ -27,6 +29,8 @@ stack_depth(struct Parrot_Interp *interpreter, struct StackChunk *chunk) { INTVAL depth; + UNUSED (interpreter); + depth = chunk->used; while (chunk->next) { @@ -39,6 +43,8 @@ struct Stack_Entry * stack_entry(struct Parrot_Interp *interpreter, struct StackChunk *chunk, INTVAL depth) { + UNUSED (interpreter); + while (chunk->next) { chunk = chunk->next; } @@ -91,6 +97,8 @@ void (*cleanup)(struct Stack_Entry *)) { struct StackChunk *chunk_base; + UNUSED (interpreter); + chunk_base = STACK_CHUNK_BASE(*top); /* Do we have any slots left in the current chunk? */ if (chunk_base->free) { @@ -149,6 +157,8 @@ /* Pop off an entry and return a pointer to the contents*/ void *pop_generic_entry(struct Parrot_Interp *interpreter, struct Stack_Entry **top, void *where, INTVAL type) { struct StackChunk *chunk_base; + + UNUSED (interpreter); chunk_base = STACK_CHUNK_BASE(*top); /* Quick sanity check */ @@ -257,6 +267,8 @@ /* get the type of the topmost stack entry */ INTVAL get_entry_type(struct Parrot_Interp *interpreter, struct Stack_Entry *entry) { + UNUSED (interpreter); + return( entry->entry_type); } --- ./string.c.orig Mon Jan 7 20:47:36 2002 +++ ./string.c Mon Jan 7 22:17:59 2002 @@ -36,6 +36,8 @@ const CHARTYPE *type) { STRING *s; + UNUSED (interpreter); + if (!type) { type = string_native_type; } @@ -221,6 +223,8 @@ string_concat(struct Parrot_Interp *interpreter, const STRING* a, const STRING* b, UINTVAL Uflags) { STRING *result; + + UNUSED (Uflags); if (a != NULL && a->strlen != 0) { if (b != NULL && b->strlen != 0) { --- ./resources.c.orig Mon Dec 31 22:46:54 2001 +++ ./resources.c Mon Jan 7 22:23:47 2002 @@ -15,6 +15,8 @@ #include "parrot/parrot.h" PMC *new_pmc_header(struct Parrot_Interp *interpreter) { + UNUSED (interpreter); + return mem_sys_allocate(sizeof(PMC)); } @@ -23,6 +25,8 @@ } STRING *new_string_header(struct Parrot_Interp *interpreter) { + UNUSED (interpreter); + return mem_sys_allocate(sizeof(STRING)); }