From 74dfe8e7d2fb4d8ea9411e9435a8457e6a956b73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Walld=C3=A9n?= <jonasw@roxen.com>
Date: Sun, 30 Dec 2012 16:37:27 +0100
Subject: [PATCH] Wrap unused parameters in UNUSED(), and debug-only parameters
 in DEBUGUSED(), to cut down on compiler warnings. The macro also renames
 parameters to catch accidental use. (There are more places to clean up but I
 don't want to modify code that isn't compiling on my machine.)

---
 src/backend.cmod                            | 12 +++---
 src/builtin_functions.c                     |  2 +-
 src/code/amd64.c                            |  2 +-
 src/constants.c                             |  2 +-
 src/cpp.c                                   | 42 ++++++++++-----------
 src/docode.c                                |  4 +-
 src/dynamic_load.c                          |  2 +-
 src/encode.c                                |  4 +-
 src/gc.c                                    |  8 ++--
 src/global.h                                | 18 +++++++++
 src/las.c                                   |  2 +-
 src/mapping.c                               |  2 +-
 src/modules/Gmp/mpf.cmod                    |  2 +-
 src/modules/Gmp/mpz_glue.c                  |  6 +--
 src/modules/Gz/zlibmod.c                    |  8 ++--
 src/modules/HTTPLoop/accept_and_parse.c     |  2 +-
 src/modules/HTTPLoop/log.c                  |  4 +-
 src/modules/HTTPLoop/requestobject.c        | 10 ++---
 src/modules/HTTPLoop/timeout.c              |  2 +-
 src/modules/Image/colors.c                  |  8 ++--
 src/modules/Image/colortable.c              | 28 +++++++-------
 src/modules/Image/encodings/ilbm.c          |  2 +-
 src/modules/Image/encodings/pcx.c           |  2 +-
 src/modules/Image/encodings/pvr.c           |  4 +-
 src/modules/Image/encodings/xcf.c           | 10 ++---
 src/modules/Image/font.c                    |  4 +-
 src/modules/Image/image.c                   |  6 +--
 src/modules/Image/layers.c                  |  6 +--
 src/modules/Image/polyfill.c                |  2 +-
 src/modules/Math/matrix_code.h              |  4 +-
 src/modules/Mysql/mysql.c                   |  4 +-
 src/modules/Mysql/result.c                  |  4 +-
 src/modules/Odbc/odbc.c                     | 14 +++----
 src/modules/Odbc/odbc_result.c              |  8 ++--
 src/modules/Parser/html.c                   |  6 +--
 src/modules/Parser/xml.cmod                 |  2 +-
 src/modules/Pipe/pipe.c                     |  8 ++--
 src/modules/Postgres/pgresult.c             |  6 +--
 src/modules/Postgres/postgres.c             |  6 +--
 src/modules/Regexp/glue.c                   |  4 +-
 src/modules/Yp/yp.c                         |  4 +-
 src/modules/_Charset/charsetmod.c           | 14 +++----
 src/modules/_Charset/iso2022.c              |  8 ++--
 src/modules/_Image_FreeType/freetype.c      |  4 +-
 src/modules/_Image_JPEG/image_jpeg.c        |  8 ++--
 src/modules/_Image_JPEG/transupp.c          |  2 +-
 src/modules/_Image_TIFF/image_tiff.c        |  4 +-
 src/modules/_Protocols_DNS_SD/sd.c          | 18 ++++-----
 src/modules/_Roxen/roxen.c                  |  4 +-
 src/modules/_WhiteFish/blobs.c              |  2 +-
 src/modules/files/file.c                    | 10 ++---
 src/modules/files/sendfile.c                |  6 +--
 src/modules/files/socket.c                  |  4 +-
 src/modules/files/stat.c                    |  2 +-
 src/modules/files/udp.c                     |  4 +-
 src/modules/system/memory.c                 |  4 +-
 src/multiset.c                              |  2 +-
 src/object.c                                |  2 +-
 src/operators.c                             |  4 +-
 src/pike_embed.c                            |  2 +-
 src/pike_search.c                           |  8 ++--
 src/post_modules/Bz2/libbzip2mod.cmod       |  2 +-
 src/post_modules/GSSAPI/gssapi.cmod         |  2 +-
 src/post_modules/Nettle/cipher.cmod         | 20 +++++-----
 src/post_modules/Shuffler/Shuffler.cmod     |  2 +-
 src/post_modules/Shuffler/c_source_stream.c |  4 +-
 src/post_modules/Unicode/normalize.c        |  2 +-
 src/program.c                               | 18 ++++-----
 src/signal_handler.c                        | 25 ++++++------
 src/svalue.c                                |  2 +-
 src/threads.c                               | 32 ++++++++--------
 71 files changed, 257 insertions(+), 240 deletions(-)

diff --git a/src/backend.cmod b/src/backend.cmod
index 4d167018bc..9eb6dc0f82 100644
--- a/src/backend.cmod
+++ b/src/backend.cmod
@@ -362,7 +362,7 @@ PIKECLASS Backend
     return b->backend_obj;
   }
 
-  static int wakeup_callback(struct fd_callback_box *box, int event)
+  static int wakeup_callback(struct fd_callback_box *box, int UNUSED(event))
   {
     char buffer[1024];
     fd_read(box->fd, buffer, sizeof(buffer)); /* Clear 'flag' */
@@ -826,9 +826,9 @@ PIKECLASS Backend
 
   }
 
-  static void count_memory_in_call_outs(struct callback *foo,
-					void *bar,
-					void *gazonk)
+  static void count_memory_in_call_outs(struct callback *UNUSED(foo),
+					void *UNUSED(bar),
+					void *UNUSED(gazonk))
   {
     backend_count_memory_in_call_outs(default_backend);
   }
@@ -3124,7 +3124,7 @@ PIKECLASS PollDeviceBackend
   }
 
 #if defined(BACKEND_USES_CFRUNLOOP)
-static void noteEvents(CFFileDescriptorRef fdref, CFOptionFlags callBackTypes, void *info) {
+static void noteEvents(CFFileDescriptorRef fdref, CFOptionFlags UNUSED(callBackTypes), void *info) {
     struct kevent kev;
     struct timespec tv;
     struct PollDeviceBackend_struct * this_backend;
@@ -3177,7 +3177,7 @@ static void noteEvents(CFFileDescriptorRef fdref, CFOptionFlags callBackTypes, v
   }
 
   /* Called in the child after fork(). */
-  static void reopen_all_pdb_backends(struct callback *cb, void *a, void *b)
+  static void reopen_all_pdb_backends(struct callback *UNUSED(cb), void *UNUSED(a), void *UNUSED(b))
   {
     int i;
     for (i=0; i < num_pdb_backends; i++) {
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 5c0b6e9aac..1f341f60b8 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -3218,7 +3218,7 @@ PMOD_EXPORT void f_indices(INT32 args)
 /* FIXME: This function messes around with the implementation of pike_type,
  * and should probably be in pike_types.h instead.
  */
-static node *fix_overloaded_type(node *n, int lfun, const char *deftype, int deftypelen)
+static node *fix_overloaded_type(node *n, int lfun, const char *deftype, int UNUSED(deftypelen))
 {
   node **first_arg;
   struct pike_type *t, *t2;
diff --git a/src/code/amd64.c b/src/code/amd64.c
index 19119d19f6..2ca456b1e7 100644
--- a/src/code/amd64.c
+++ b/src/code/amd64.c
@@ -906,7 +906,7 @@ void amd64_start_function(int store_lines )
 }
 
 /* Called when the current function is done */
-void amd64_end_function(int no_pc)
+void amd64_end_function(int UNUSED(no_pc))
 {
   branch_check_threads_update_etc = 0;
 }
diff --git a/src/constants.c b/src/constants.c
index e76a02d972..a766302617 100644
--- a/src/constants.c
+++ b/src/constants.c
@@ -159,7 +159,7 @@ PMOD_EXPORT void add_efun(const char *name, c_fun fun, const char *type, int fla
 
 PMOD_EXPORT void quick_add_efun(const char *name, ptrdiff_t name_length,
                                 c_fun fun,
-                                const char *type, ptrdiff_t type_length,
+                                const char *type, ptrdiff_t UNUSED(type_length),
                                 int flags,
                                 optimize_fun optimize,
                                 docode_fun docode)
diff --git a/src/cpp.c b/src/cpp.c
index 160a3097a7..e8400a549d 100644
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -841,7 +841,7 @@ void cpp_change_compat(struct cpp *this, int major, int minor)
  *!   @[#if], @[#ifdef], @[constant()]
  */
 static void check_defined(struct cpp *this,
-			  struct define *def,
+			  struct define *UNUSED(def),
 			  struct define_argument *args,
 			  struct string_builder *tmp)
 {
@@ -2048,8 +2048,8 @@ static ptrdiff_t low_cpp(struct cpp *this, void *data, ptrdiff_t len,
  *! integer, in the source file.
  */
 static void insert_current_line(struct cpp *this,
-				struct define *def,
-				struct define_argument *args,
+				struct define *UNUSED(def),
+				struct define_argument *UNUSED(args),
 				struct string_builder *tmp)
 {
   string_builder_sprintf(tmp, " %ld ", (long)this->current_line);
@@ -2060,8 +2060,8 @@ static void insert_current_line(struct cpp *this,
  *! This define contains the file path and name of the source file.
  */
 static void insert_current_file_as_string(struct cpp *this,
-					  struct define *def,
-					  struct define_argument *args,
+					  struct define *UNUSED(def),
+					  struct define_argument *UNUSED(args),
 					  struct string_builder *tmp)
 {
   PUSH_STRING_SHIFT(this->current_file->str, this->current_file->len,
@@ -2073,8 +2073,8 @@ static void insert_current_file_as_string(struct cpp *this,
  *! This define contains the directory path of the source file.
  */
 static void insert_current_dir_as_string(struct cpp *this,
-                                         struct define *def,
-                                         struct define_argument *args,
+                                         struct define *UNUSED(def),
+                                         struct define_argument *UNUSED(args),
                                          struct string_builder *tmp)
 {
   ref_push_string(this->current_file);
@@ -2090,9 +2090,9 @@ static void insert_current_dir_as_string(struct cpp *this,
  *! This define contains the current time at the time of compilation,
  *! e.g. "12:20:51".
  */
-static void insert_current_time_as_string(struct cpp *this,
-					  struct define *def,
-					  struct define_argument *args,
+static void insert_current_time_as_string(struct cpp *UNUSED(this),
+					  struct define *UNUSED(def),
+					  struct define_argument *UNUSED(args),
 					  struct string_builder *tmp)
 {
   /* FIXME: Is this code safe? */
@@ -2109,9 +2109,9 @@ static void insert_current_time_as_string(struct cpp *this,
  *! This define contains the current date at the time of compilation,
  *! e.g. "Jul 28 2001".
  */
-static void insert_current_date_as_string(struct cpp *this,
-					  struct define *def,
-					  struct define_argument *args,
+static void insert_current_date_as_string(struct cpp *UNUSED(this),
+					  struct define *UNUSED(def),
+					  struct define_argument *UNUSED(args),
 					  struct string_builder *tmp)
 {
   /* FIXME: Is this code safe? */
@@ -2134,8 +2134,8 @@ static void insert_current_date_as_string(struct cpp *this,
  *!   @[__REAL_VERSION__]
  */
 static void insert_current_version(struct cpp *this,
-				   struct define *def,
-				   struct define_argument *args,
+				   struct define *UNUSED(def),
+				   struct define_argument *UNUSED(args),
 				   struct string_builder *tmp)
 {
   string_builder_sprintf(tmp, " %d.%d ", this->compat_major,
@@ -2152,8 +2152,8 @@ static void insert_current_version(struct cpp *this,
  *!   @[__REAL_MINOR__]
  */
 static void insert_current_minor(struct cpp *this,
-				 struct define *def,
-				 struct define_argument *args,
+				 struct define *UNUSED(def),
+				 struct define_argument *UNUSED(args),
 				 struct string_builder *tmp)
 {
   string_builder_sprintf(tmp, " %d ", this->compat_minor);
@@ -2169,8 +2169,8 @@ static void insert_current_minor(struct cpp *this,
  *!   @[__REAL_MAJOR__]
  */
 static void insert_current_major(struct cpp *this,
-				 struct define *def,
-				 struct define_argument *args,
+				 struct define *UNUSED(def),
+				 struct define_argument *UNUSED(args),
 				 struct string_builder *tmp)
 {
   string_builder_sprintf(tmp, " %d ", this->compat_major);
@@ -2189,7 +2189,7 @@ static void insert_current_major(struct cpp *this,
  *!   @[#pragma]
  */
 static void insert_pragma(struct cpp *this,
-			  struct define *def,
+			  struct define *UNUSED(def),
 			  struct define_argument *args,
 			  struct string_builder *tmp)
 {
@@ -2267,7 +2267,7 @@ static void insert_callback_define(struct cpp *this,
 
 static void insert_callback_define_no_args(struct cpp *this,
                                            struct define *def,
-                                           struct define_argument *args,
+                                           struct define_argument *UNUSED(args),
                                            struct string_builder *tmp)
 {
   struct svalue *save_sp = Pike_sp;
diff --git a/src/docode.c b/src/docode.c
index 8c0a37a0b8..2ddcf48bcd 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -271,13 +271,13 @@ void do_pop(int x)
   current_stack_depth -= x;
 }
 
-static void do_pop_mark(void *ignored)
+static void do_pop_mark(void *UNUSED(ignored))
 {
   struct compilation *c = THIS_COMPILATION;
   emit0(F_POP_MARK);
 }
 
-static void do_pop_to_mark(void *ignored)
+static void do_pop_to_mark(void *UNUSED(ignored))
 {
   struct compilation *c = THIS_COMPILATION;
   emit0(F_POP_TO_MARK);
diff --git a/src/dynamic_load.c b/src/dynamic_load.c
index a6192e37b2..ace32e545d 100644
--- a/src/dynamic_load.c
+++ b/src/dynamic_load.c
@@ -382,7 +382,7 @@ static modfun CAST_TO_FUN(void *ptr)
 #define CAST_TO_FUN(X)	((modfun)X)
 #endif /* NO_CAST_TO_FUN */
 
-static void cleanup_compilation(void *ignored)
+static void cleanup_compilation(void *UNUSED(ignored))
 {
   struct program *p = end_program();
   if (p) {
diff --git a/src/encode.c b/src/encode.c
index a52fa137a1..4ff1dd938f 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -2538,7 +2538,7 @@ static int init_placeholder(struct object *placeholder);
   (X)=pop_unfinished_type();			\
 } while(0)
 
-static void cleanup_new_program_decode (void *ignored)
+static void cleanup_new_program_decode (void *UNUSED(ignored))
 {
   debug_malloc_touch(Pike_compiler->new_program);
   debug_malloc_touch(Pike_compiler->new_program->parent);
@@ -4848,7 +4848,7 @@ static int init_placeholder(struct object *placeholder)
 static struct decode_data *current_decode = NULL;
 
 static void free_decode_data (struct decode_data *data, int delay,
-			      int free_after_error)
+			      int DEBUGUSED(free_after_error))
 {
 #ifdef PIKE_DEBUG
   int e;
diff --git a/src/gc.c b/src/gc.c
index 67108cbe32..01d6aeaa05 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1001,7 +1001,7 @@ static void describe_marker(struct marker *m)
 
 #endif /* PIKE_DEBUG */
 
-static void debug_gc_fatal_va (void *a, int type, int flags,
+static void debug_gc_fatal_va (void *DEBUGUSED(a), int DEBUGUSED(type), int DEBUGUSED(flags),
 			       const char *fmt, va_list args)
 {
   int orig_gc_pass = Pike_in_gc;
@@ -3426,7 +3426,7 @@ static void warn_bad_cycles(void)
   CALL_AND_UNSET_ONERROR(tmp);
 }
 
-size_t do_gc(void *ignored, int explicit_call)
+size_t do_gc(void *UNUSED(ignored), int explicit_call)
 {
   ALLOC_COUNT_TYPE start_allocs;
   size_t start_num_objs, unreferenced;
@@ -5142,8 +5142,8 @@ static void pass_lookahead_visit_ref (void *thing, int ref_type,
     MC_DEBUG_MSG (ref_to, "not enqueued");
 }
 
-static void pass_mark_external_visit_ref (void *thing, int ref_type,
-					  visit_thing_fn *visit_fn, void *extra)
+static void pass_mark_external_visit_ref (void *thing, int UNUSED(ref_type),
+					  visit_thing_fn *UNUSED(visit_fn), void *UNUSED(extra))
 {
   struct mc_marker *ref_to = find_mc_marker (thing);
 
diff --git a/src/global.h b/src/global.h
index 024d623387..79b17e942c 100644
--- a/src/global.h
+++ b/src/global.h
@@ -548,6 +548,24 @@ typedef struct p_wchar_p
 #endif
 #endif
 
+/* Suppress compiler warnings for unused parameters if possible. The mangling of
+   argument name is required to catch when an unused argument later is used without
+   removing the annotation. */
+#ifndef UNUSED
+# ifdef __GNUC__
+#  define UNUSED(x)  PIKE_CONCAT(x,_UNUSED) __attribute__((unused))
+# else
+#  define UNUSED(x)  PIKE_CONCAT(x,_UNUSED)
+# endif
+#endif
+#ifndef DEBUGUSED
+# ifdef PIKE_DEBUG
+#  define DEBUGUSED(x) x
+# else
+#  define DEBUGUSED(x) UNUSED(x)
+# endif
+#endif
+
 /* PMOD_EXPORT exports a function / variable vfsh. */
 #ifndef PMOD_EXPORT
 # if defined (__NT__) && defined (USE_DLL)
diff --git a/src/las.c b/src/las.c
index 3a6c41aade..7b4e1212c3 100644
--- a/src/las.c
+++ b/src/las.c
@@ -5225,7 +5225,7 @@ struct timer_oflo
   int yes;
 };
 
-static void check_evaluation_time(struct callback *cb,void *tmp,void *ignored)
+static void check_evaluation_time(struct callback *UNUSED(cb), void *tmp, void *UNUSED(ignored))
 {
   struct timer_oflo *foo=(struct timer_oflo *)tmp;
   if(foo->counter-- < 0)
diff --git a/src/mapping.c b/src/mapping.c
index 64ba8fae9f..7773ea2801 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -2403,7 +2403,7 @@ void check_all_mappings(void)
 #endif
 
 static void visit_mapping_data (struct mapping_data *md, int action,
-				struct mapping *m)
+				struct mapping *UNUSED(m))
 {
   switch (action) {
 #ifdef PIKE_DEBUG
diff --git a/src/modules/Gmp/mpf.cmod b/src/modules/Gmp/mpf.cmod
index 6b9086e6ac..6ad6907da5 100644
--- a/src/modules/Gmp/mpf.cmod
+++ b/src/modules/Gmp/mpf.cmod
@@ -111,7 +111,7 @@ PIKECLASS mpf
 {
   CVAR MP_FLT n;
 
-  static void get_mpf_from_digits(MP_FLT *tmp,
+  static void get_mpf_from_digits(MP_FLT *UNUSED(tmp),
 				  struct pike_string *digits,
 				  int base)
     {
diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c
index 0e55b35013..bffeecfe8f 100644
--- a/src/modules/Gmp/mpz_glue.c
+++ b/src/modules/Gmp/mpz_glue.c
@@ -2218,7 +2218,7 @@ static void gmp_fac(INT32 args)
   PUSH_REDUCED(res);
 }
 
-static void init_mpz_glue(struct object *o)
+static void init_mpz_glue(struct object * UNUSED(o))
 {
 #ifdef PIKE_DEBUG
   if(!fp) Pike_fatal("ZERO FP\n");
@@ -2227,7 +2227,7 @@ static void init_mpz_glue(struct object *o)
   mpz_init(THIS);
 }
 
-static void exit_mpz_glue(struct object *o)
+static void exit_mpz_glue(struct object *UNUSED(o))
 {
 #ifdef PIKE_DEBUG
   if(!fp) Pike_fatal("ZERO FP\n");
@@ -2306,7 +2306,7 @@ static void *pike_mp_realloc (void *ptr, size_t old_size, size_t new_size)
   return ret;
 }
 
-static void pike_mp_free (void *ptr, size_t size)
+static void pike_mp_free (void *ptr, size_t UNUSED(size))
 {
   free (ptr);
 }
diff --git a/src/modules/Gz/zlibmod.c b/src/modules/Gz/zlibmod.c
index 92b84a0801..aa8c1f79ad 100644
--- a/src/modules/Gz/zlibmod.c
+++ b/src/modules/Gz/zlibmod.c
@@ -599,7 +599,7 @@ static void gz_deflate(INT32 args)
 }
 
 
-static void init_gz_deflate(struct object *o)
+static void init_gz_deflate(struct object *UNUSED(o))
 {
   mt_init(& THIS->lock);
   MEMSET(& THIS->gz, 0, sizeof(THIS->gz));
@@ -611,7 +611,7 @@ static void init_gz_deflate(struct object *o)
   THIS->epilogue = NULL;
 }
 
-static void exit_gz_deflate(struct object *o)
+static void exit_gz_deflate(struct object *UNUSED(o))
 {
 /*   mt_lock(& THIS->lock); */
   deflateEnd(&THIS->gz);
@@ -1014,7 +1014,7 @@ static void gz_end_of_stream(INT32 args)
     push_int(0);
 }
 
-static void init_gz_inflate(struct object *o)
+static void init_gz_inflate(struct object *UNUSED(o))
 {
   mt_init(& THIS->lock);
   MEMSET(& THIS->gz, 0, sizeof(THIS->gz));
@@ -1026,7 +1026,7 @@ static void init_gz_inflate(struct object *o)
   THIS->epilogue = NULL;
 }
 
-static void exit_gz_inflate(struct object *o)
+static void exit_gz_inflate(struct object *UNUSED(o))
 {
 /*   mt_lock(& THIS->lock); */
   inflateEnd(& THIS->gz);
diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c
index 29bc024cc9..2e384e8503 100644
--- a/src/modules/HTTPLoop/accept_and_parse.c
+++ b/src/modules/HTTPLoop/accept_and_parse.c
@@ -519,7 +519,7 @@ static void low_accept_loop(struct args *arg)
 }
 
 
-static void finished_p(struct callback *foo, void *b, void *c)
+static void finished_p(struct callback *UNUSED(foo), void *UNUSED(b), void *UNUSED(c))
 {
   extern void f_low_aap_reqo__init( struct c_request_object * );
 
diff --git a/src/modules/HTTPLoop/log.c b/src/modules/HTTPLoop/log.c
index daf7fdf06f..e3c0e05525 100644
--- a/src/modules/HTTPLoop/log.c
+++ b/src/modules/HTTPLoop/log.c
@@ -110,7 +110,7 @@ void f_aap_log_as_array(INT32 args)
   }
 }
 
-void f_aap_log_exists(INT32 args)
+void f_aap_log_exists(INT32 UNUSED(args))
 {
   if(LTHIS->log->log_head) 
     push_int(1);
@@ -118,7 +118,7 @@ void f_aap_log_exists(INT32 args)
     push_int(0);
 }
 
-void f_aap_log_size(INT32 args)
+void f_aap_log_size(INT32 UNUSED(args))
 {
   int n=1;
   struct log *l = LTHIS->log;
diff --git a/src/modules/HTTPLoop/requestobject.c b/src/modules/HTTPLoop/requestobject.c
index 93fed8b4e3..de7b92403c 100644
--- a/src/modules/HTTPLoop/requestobject.c
+++ b/src/modules/HTTPLoop/requestobject.c
@@ -252,7 +252,7 @@ void f_aap_scan_for_query(INT32 args)
 
 
 static void decode_x_url_mixed(char *in, ptrdiff_t l, struct mapping *v,
-			       char *dec, char *rest_query, char **rp)
+			       char *dec, char *UNUSED(rest_query), char **rp)
 {
   ptrdiff_t pos = 0, lamp = 0, leq=0, dl;
 
@@ -645,12 +645,12 @@ void f_aap_index_op(INT32 args)
   
 /* } */
 
-void f_aap_end(INT32 args)
+void f_aap_end(INT32 UNUSED(args))
 {
   /* end connection. */
 }
 
-void f_aap_output(INT32 args)
+void f_aap_output(INT32 UNUSED(args))
 {
   if(TYPEOF(sp[-1]) != T_STRING) Pike_error("Bad argument 1 to output\n");
   WRITE(THIS->request->fd, sp[-1].u.string->str, sp[-1].u.string->len);
@@ -1072,12 +1072,12 @@ void f_low_aap_reqo__init(struct c_request_object *o)
 	  o->request->res.url, o->request->res.url_len);
 }
 
-void aap_init_request_object(struct object *o)
+void aap_init_request_object(struct object *UNUSED(o))
 {
   MEMSET(THIS, 0, sizeof(*THIS));
 }
 
-void aap_exit_request_object(struct object *o)
+void aap_exit_request_object(struct object *UNUSED(o))
 {
   if(THIS->request)
     free_args( THIS->request );
diff --git a/src/modules/HTTPLoop/timeout.c b/src/modules/HTTPLoop/timeout.c
index 8853777be8..fe02afb7c8 100644
--- a/src/modules/HTTPLoop/timeout.c
+++ b/src/modules/HTTPLoop/timeout.c
@@ -162,7 +162,7 @@ static volatile int aap_time_to_die = 0;
 
 static COND_T aap_timeout_thread_is_dead;
 
-static void *handle_timeouts(void *ignored)
+static void *handle_timeouts(void *UNUSED(ignored))
 {
   while(1)
   {
diff --git a/src/modules/Image/colors.c b/src/modules/Image/colors.c
index 876d6bcd24..b2ae0519de 100644
--- a/src/modules/Image/colors.c
+++ b/src/modules/Image/colors.c
@@ -331,13 +331,13 @@ static void make_colors(void)
 #define THIS ((struct color_struct*)(Pike_fp->current_storage))
 #define THISOBJ (Pike_fp->current_object)
 
-static void init_color_struct(struct object *dummy)
+static void init_color_struct(struct object *UNUSED(dummy))
 {
    THIS->rgb.r=THIS->rgb.g=THIS->rgb.b=0;
    THIS->name=NULL;
 }
 
-static void exit_color_struct(struct object *dummy)
+static void exit_color_struct(struct object *UNUSED(dummy))
 {
    if (THIS->name) 
    {
@@ -1514,7 +1514,7 @@ static void _image_make_rgbl_color(INT32 r,INT32 g,INT32 b)
    RGBL_TO_RGB(cs->rgb,cs->rgbl);
 }
 
-static void image_color__encode( INT32 args )
+static void image_color__encode( INT32 UNUSED(args) )
 {
     push_int( THIS->rgbl.r );
     push_int( THIS->rgbl.g );
@@ -1522,7 +1522,7 @@ static void image_color__encode( INT32 args )
     f_aggregate( 3 );
 }
 
-static void image_color__decode( INT32 args )
+static void image_color__decode( INT32 UNUSED(args) )
 {
     struct svalue *a;
     if( TYPEOF(Pike_sp[-1]) != PIKE_T_ARRAY || Pike_sp[-1].u.array->size != 3 )
diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c
index be54969f53..55932b667d 100644
--- a/src/modules/Image/colortable.c
+++ b/src/modules/Image/colortable.c
@@ -175,12 +175,12 @@ static void colortable_init_stuff(struct neo_colortable *nct)
    nct->dither_type=NCTD_NONE;
 }
 
-static void init_colortable_struct(struct object *obj)
+static void init_colortable_struct(struct object *UNUSED(obj))
 {
    colortable_init_stuff(THIS);
 }
 
-static void exit_colortable_struct(struct object *obj)
+static void exit_colortable_struct(struct object *UNUSED(obj))
 {
    free_colortable_struct(THIS);
 }
@@ -770,7 +770,7 @@ static INLINE rgb_group get_mask_of_level(int level)
 }
 
 static struct nct_flat _img_get_flat_from_image(struct image *img,
-						unsigned long maxcols)
+						unsigned long UNUSED(maxcols))
 {
    struct color_hash_entry *hash;
    unsigned long hashsize=DEFAULT_COLOR_HASH_SIZE;
@@ -1826,7 +1826,7 @@ static void dither_floyd_steinberg_firstline(struct nct_dither *dith,
 }
 
 static rgbl_group dither_randomcube_encode(struct nct_dither *dith,
-					   int rowpos,
+					   int UNUSED(rowpos),
 					   rgb_group s)
 {
    rgbl_group rgb;
@@ -1841,7 +1841,7 @@ static rgbl_group dither_randomcube_encode(struct nct_dither *dith,
 }
 
 static rgbl_group dither_randomgrey_encode(struct nct_dither *dith,
-					   int rowpos,
+					   int UNUSED(rowpos),
 					   rgb_group s)
 {
    rgbl_group rgb;
@@ -1858,13 +1858,13 @@ static rgbl_group dither_randomgrey_encode(struct nct_dither *dith,
 }
 
 static void dither_ordered_newline(struct nct_dither *dith,
-				   int *rowpos,
-				   rgb_group **s,
-				   rgb_group **drgb,
-				   unsigned char **d8bit,
-				   unsigned short **d16bit,
-				   unsigned INT32 **d32bit,
-				   int *cd)
+				   int *UNUSED(rowpos),
+				   rgb_group **UNUSED(s),
+				   rgb_group **UNUSED(drgb),
+				   unsigned char **UNUSED(d8bit),
+				   unsigned short **UNUSED(d16bit),
+				   unsigned INT32 **UNUSED(d32bit),
+				   int *UNUSED(cd))
 {
    dith->u.ordered.row++;
 }
@@ -2704,7 +2704,7 @@ void image_colortable_cast_to_string(struct neo_colortable *nct)
    push_string(end_shared_string(str));
 }
 
-static void image_colortable__encode( INT32 args )
+static void image_colortable__encode( INT32 UNUSED(args) )
 {
     image_colortable_cast_to_string( THIS );
 }
@@ -3175,7 +3175,7 @@ static void _cub_add_cs_full_recur(int **pp,int *i,int *p,
 }
 
 static INLINE void _cub_add_cs(struct neo_colortable *nct,
-			       struct nctlu_cubicle *cub,
+			       struct nctlu_cubicle *UNUSED(cub),
 			       int **pp,int *i,int *p,
 			       int ri,int gi,int bi,
 			       int red,int green,int blue,
diff --git a/src/modules/Image/encodings/ilbm.c b/src/modules/Image/encodings/ilbm.c
index 1352cb68d4..4a7bf1c155 100644
--- a/src/modules/Image/encodings/ilbm.c
+++ b/src/modules/Image/encodings/ilbm.c
@@ -691,7 +691,7 @@ static void chunky2planar(INT32 *src, int w,
 }
 
 static struct pike_string *make_body(struct BMHD *bmhd,
-				     struct image *img, struct image *alpha,
+				     struct image *img, struct image *UNUSED(alpha),
 				     struct neo_colortable *ctable)
 {
   unsigned int x, y;
diff --git a/src/modules/Image/encodings/pcx.c b/src/modules/Image/encodings/pcx.c
index b9846a664d..c6341e5eae 100644
--- a/src/modules/Image/encodings/pcx.c
+++ b/src/modules/Image/encodings/pcx.c
@@ -434,7 +434,7 @@ static void f_rle_encode( INT32 args )
 
 static struct pike_string *encode_pcx_24( struct pcx_header *pcx_header,
                                           struct image *data,
-                                          struct options *opts )
+                                          struct options *UNUSED(opts) )
 {
   struct pike_string *b;
   int x, y;
diff --git a/src/modules/Image/encodings/pvr.c b/src/modules/Image/encodings/pvr.c
index 4d49fc563c..7c07a2ca54 100644
--- a/src/modules/Image/encodings/pvr.c
+++ b/src/modules/Image/encodings/pvr.c
@@ -726,7 +726,7 @@ void image_pvr_f_encode(INT32 args)
 }
 
 static void pvr_decode_rect(INT32 attr, unsigned char *src, rgb_group *dst,
-			    INT32 stride, unsigned int h, unsigned int w)
+			    INT32 UNUSED(stride), unsigned int h, unsigned int w)
 {
   INT32 cnt = h * w;
   switch(attr&0xff) {
@@ -908,7 +908,7 @@ static void pvr_decode_twiddled(INT32 attr, unsigned char *s, rgb_group *dst,
 }
 
 static void pvr_decode_alpha_rect(INT32 attr, unsigned char *src,
-				  rgb_group *dst, INT32 stride,
+				  rgb_group *dst, INT32 UNUSED(stride),
 				  unsigned int h, unsigned int w)
 {
   INT32 cnt = h * w;
diff --git a/src/modules/Image/encodings/xcf.c b/src/modules/Image/encodings/xcf.c
index e6b3efdf82..46902e42bb 100644
--- a/src/modules/Image/encodings/xcf.c
+++ b/src/modules/Image/encodings/xcf.c
@@ -119,7 +119,7 @@ static void f_substring__sprintf( INT32 args )
   }
 }
 
-static void f_substring_get_int( INT32 args )
+static void f_substring_get_int( INT32 UNUSED(args) )
 {
   struct substring *s = SS(fp->current_object);
   int res;
@@ -134,7 +134,7 @@ static void f_substring_get_int( INT32 args )
 }
 
 
-static void f_substring_get_uint( INT32 args )
+static void f_substring_get_uint( INT32 UNUSED(args) )
 {
   struct substring *s = SS(fp->current_object);
   unsigned int res;
@@ -148,7 +148,7 @@ static void f_substring_get_uint( INT32 args )
   push_int64( res );
 }
 
-static void f_substring_get_ushort( INT32 args )
+static void f_substring_get_ushort( INT32 UNUSED(args) )
 {
   struct substring *s = SS(fp->current_object);
   unsigned short res;
@@ -162,7 +162,7 @@ static void f_substring_get_ushort( INT32 args )
   push_int( res );
 }
 
-static void f_substring_get_short( INT32 args )
+static void f_substring_get_short( INT32 UNUSED(args) )
 {
   struct substring *s = SS(fp->current_object);
   short res;
@@ -189,7 +189,7 @@ static void push_substring( struct pike_string *s,
   push_object( o );
 }
 
-static void free_substring(struct object *o)
+static void free_substring(struct object *UNUSED(o))
 {
   if( SS(fp->current_object)->s )
   {
diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c
index 22cceb2617..dc7ee051c2 100644
--- a/src/modules/Image/font.c
+++ b/src/modules/Image/font.c
@@ -194,12 +194,12 @@ static INLINE void free_font_struct(struct font *font)
    }
 }
 
-static void init_font_struct(struct object *o)
+static void init_font_struct(struct object *UNUSED(o))
 {
   THIS=NULL;
 }
 
-static void exit_font_struct(struct object *obj)
+static void exit_font_struct(struct object *UNUSED(obj))
 {
    free_font_struct(THIS);
    THIS=NULL;
diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c
index d7e539036c..57dae2fe3d 100644
--- a/src/modules/Image/image.c
+++ b/src/modules/Image/image.c
@@ -175,7 +175,7 @@ static void chrono(char *x)
 
 /***************** init & exit *********************************/
 
-static void init_image_struct(struct object *obj)
+static void init_image_struct(struct object *UNUSED(obj))
 {
   THIS->img=NULL;
   THIS->rgb.r=0;
@@ -186,7 +186,7 @@ static void init_image_struct(struct object *obj)
 /*  fprintf(stderr,"init %lx (%d)\n",obj,++obj_counter);*/
 }
 
-static void exit_image_struct(struct object *obj)
+static void exit_image_struct(struct object *UNUSED(obj))
 {
   if (THIS->img) { free(THIS->img); THIS->img=NULL; }
 /*
@@ -4826,7 +4826,7 @@ void image_tobitmap(INT32 args)
 
 /***************** Serialization methods ***********************/
 
-void image__encode( INT32 args )
+void image__encode( INT32 UNUSED(args) )
 {
     push_int( THIS->xsize );
     push_int( THIS->ysize );
diff --git a/src/modules/Image/layers.c b/src/modules/Image/layers.c
index 305503aa6c..97601d25f9 100644
--- a/src/modules/Image/layers.c
+++ b/src/modules/Image/layers.c
@@ -669,7 +669,7 @@ static int really_optimize_p(struct layer *l)
 
 /*** layer object : init and exit *************************/
 
-static void init_layer(struct object *dummy)
+static void init_layer(struct object *UNUSED(dummy))
 {
    THIS->xsize=0;
    THIS->ysize=0;
@@ -692,7 +692,7 @@ static void init_layer(struct object *dummy)
    smear_color(THIS->sfill_alpha,THIS->fill_alpha,SNUMPIXS);
 }
 
-static void free_layer(struct layer *l)
+static void free_layer(struct layer *UNUSED(l))
 {
    if (THIS->image) free_object(THIS->image);
    if (THIS->alpha) free_object(THIS->alpha);
@@ -703,7 +703,7 @@ static void free_layer(struct layer *l)
    THIS->alp=NULL;
 }
 
-static void exit_layer(struct object *dummy)
+static void exit_layer(struct object *UNUSED(dummy))
 {
    free_layer(THIS);
 }
diff --git a/src/modules/Image/polyfill.c b/src/modules/Image/polyfill.c
index 29109c907d..a5ea667479 100644
--- a/src/modules/Image/polyfill.c
+++ b/src/modules/Image/polyfill.c
@@ -304,7 +304,7 @@ static void add_vertices(struct line_list **first,
 
 static void sub_vertices(struct line_list **first,
 			 struct vertex *below,
-			 double yp)
+			 double UNUSED(yp))
 {
    struct line_list **ins,*c;
 
diff --git a/src/modules/Math/matrix_code.h b/src/modules/Math/matrix_code.h
index e96150de52..65f5773be6 100644
--- a/src/modules/Math/matrix_code.h
+++ b/src/modules/Math/matrix_code.h
@@ -38,13 +38,13 @@ struct matrixX(_storage)
 
 static void matrixX(_mult)( INT32 args );
 
-static void Xmatrix(init_)(struct object *o)
+static void Xmatrix(init_)(struct object *UNUSED(o))
 {
    THIS->xsize=THIS->ysize=0;
    THIS->m=NULL;
 }
 
-static void Xmatrix(exit_)(struct object *o)
+static void Xmatrix(exit_)(struct object *UNUSED(o))
 {
    if (THIS->m) free(THIS->m);
 }
diff --git a/src/modules/Mysql/mysql.c b/src/modules/Mysql/mysql.c
index caeb2c8def..0e7166fafb 100644
--- a/src/modules/Mysql/mysql.c
+++ b/src/modules/Mysql/mysql.c
@@ -185,7 +185,7 @@ static MUTEX_T stupid_port_lock;
  * State maintenance
  */
 
-static void init_mysql_struct(struct object *o)
+static void init_mysql_struct(struct object *UNUSED(o))
 {
   MEMSET(PIKE_MYSQL, 0, sizeof(struct precompiled_mysql));
   INIT_MYSQL_LOCK();
@@ -194,7 +194,7 @@ static void init_mysql_struct(struct object *o)
     Pike_error ("Out of memory when initializing mysql connection.\n");
 }
 
-static void exit_mysql_struct(struct object *o)
+static void exit_mysql_struct(struct object *UNUSED(o))
 {
   MYSQL *mysql = PIKE_MYSQL->mysql;
 
diff --git a/src/modules/Mysql/result.c b/src/modules/Mysql/result.c
index d47fe5280f..a189ced378 100644
--- a/src/modules/Mysql/result.c
+++ b/src/modules/Mysql/result.c
@@ -120,12 +120,12 @@ static struct svalue mpq_program = SVALUE_INIT_FREE;
  * State maintenance
  */
 
-static void init_res_struct(struct object *o)
+static void init_res_struct(struct object *UNUSED(o))
 {
   memset(PIKE_MYSQL_RES, 0, sizeof(struct precompiled_mysql_result));
 }
 
-static void exit_res_struct(struct object *o)
+static void exit_res_struct(struct object *UNUSED(o))
 {
   if (PIKE_MYSQL_RES->result) {
     mysql_free_result(PIKE_MYSQL_RES->result);
diff --git a/src/modules/Odbc/odbc.c b/src/modules/Odbc/odbc.c
index b8769ab8dd..9f575404d1 100644
--- a/src/modules/Odbc/odbc.c
+++ b/src/modules/Odbc/odbc.c
@@ -238,7 +238,7 @@ static void clean_last_error(void)
  *!   @[Sql.odbc], @[Sql.dsn]
  */
 
-static void init_odbc_struct(struct object *o)
+static void init_odbc_struct(struct object *UNUSED(o))
 {
   HDBC hdbc = SQL_NULL_HDBC;
   RETCODE code;
@@ -256,7 +256,7 @@ static void init_odbc_struct(struct object *o)
 		   code, NULL, NULL);
 }
 
-static void exit_odbc_struct(struct object *o)
+static void exit_odbc_struct(struct object *UNUSED(o))
 {
   SQLHDBC hdbc = PIKE_ODBC->hdbc;
 
@@ -446,7 +446,7 @@ static void f_affected_rows(INT32 args)
   push_int64(PIKE_ODBC->affected_rows);
 }
 
-static void f_select_db(INT32 args)
+static void f_select_db(INT32 UNUSED(args))
 {
   /**********************************************/
 }
@@ -582,22 +582,22 @@ static void f_list_tables(INT32 args)
 #endif /* PIKE_DEBUG */
 }
 
-static void f_create_db(INT32 args)
+static void f_create_db(INT32 UNUSED(args))
 {
   /**************************************************/
 }
 
-static void f_drop_db(INT32 args)
+static void f_drop_db(INT32 UNUSED(args))
 {
   /**************************************************/
 }
 
-static void f_shutdown(INT32 args)
+static void f_shutdown(INT32 UNUSED(args))
 {
   /**************************************************/
 }
 
-static void f_reload(INT32 args)
+static void f_reload(INT32 UNUSED(args))
 {
   /**************************************************/
 }
diff --git a/src/modules/Odbc/odbc_result.c b/src/modules/Odbc/odbc_result.c
index 5dcdd2748f..575b164f22 100644
--- a/src/modules/Odbc/odbc_result.c
+++ b/src/modules/Odbc/odbc_result.c
@@ -105,13 +105,13 @@ static INLINE void odbc_check_error(const char *fun, const char *msg,
  * State maintenance
  */
  
-static void init_res_struct(struct object *o)
+static void init_res_struct(struct object *UNUSED(o))
 {
   memset(PIKE_ODBC_RES, 0, sizeof(struct precompiled_odbc_result));
   PIKE_ODBC_RES->hstmt = SQL_NULL_HSTMT;
 }
  
-static void exit_res_struct(struct object *o)
+static void exit_res_struct(struct object *UNUSED(o))
 {
   if (PIKE_ODBC_RES->hstmt != SQL_NULL_HSTMT) {
     SQLHSTMT hstmt = PIKE_ODBC_RES->hstmt;
@@ -801,13 +801,13 @@ static void f_fetch_row(INT32 args)
 }
  
 /* int eof() */
-static void f_eof(INT32 args)
+static void f_eof(INT32 UNUSED(args))
 {
   Pike_error("odbc->eof(): Not implemented yet!\n");
 }
 
 /* void seek() */
-static void f_seek(INT32 args)
+static void f_seek(INT32 UNUSED(args))
 {
   Pike_error("odbc->seek(): Not implemented yet!\n");
 }
diff --git a/src/modules/Parser/html.c b/src/modules/Parser/html.c
index b842c90fa5..f920acfe16 100644
--- a/src/modules/Parser/html.c
+++ b/src/modules/Parser/html.c
@@ -717,7 +717,7 @@ static INLINE struct calc_chars *select_variant (int flags)
 }
 #endif
 
-static void init_html_struct(struct object *o)
+static void init_html_struct(struct object *UNUSED(o))
 {
 #ifdef HTML_DEBUG
    THIS->flags=0;
@@ -779,7 +779,7 @@ static void init_html_struct(struct object *o)
    recalculate_argq(THIS);
 }
 
-static void exit_html_struct(struct object *o)
+static void exit_html_struct(struct object *UNUSED(o))
 {
    DEBUG((stderr,"exit_html_struct %p\n",THIS));
 
@@ -1794,7 +1794,7 @@ found:
    return 1;
 }
 
-static int scan_for_string (struct parser_html_storage *this,
+static int scan_for_string (struct parser_html_storage *UNUSED(this),
 			    struct piece *feed,
 			    ptrdiff_t c,
 			    struct piece **destp,
diff --git a/src/modules/Parser/xml.cmod b/src/modules/Parser/xml.cmod
index 3cf8a8a078..cd2e07ae4b 100644
--- a/src/modules/Parser/xml.cmod
+++ b/src/modules/Parser/xml.cmod
@@ -1087,7 +1087,7 @@ PIKECLASS Simple
 #endif /* PIKE_DEBUG */
 
 
-static inline int xmlread(int z, int line)
+static inline int xmlread(int z, int UNUSED(line))
 {
   int popped=0;
   THIS->input->pos += z;
diff --git a/src/modules/Pipe/pipe.c b/src/modules/Pipe/pipe.c
index 31f6cbd33f..b66161d6f7 100644
--- a/src/modules/Pipe/pipe.c
+++ b/src/modules/Pipe/pipe.c
@@ -1253,7 +1253,7 @@ void close_and_free_everything(struct object *thisobj,struct pipe *p)
    /* p->done=0; */
 }
 
-static void init_pipe_struct(struct object *o)
+static void init_pipe_struct(struct object *UNUSED(o))
 {
    debug_malloc_touch(o);
 
@@ -1273,12 +1273,12 @@ static void init_pipe_struct(struct object *o)
    THIS->sent=0;
 }
 
-static void exit_pipe_struct(struct object *o)
+static void exit_pipe_struct(struct object *UNUSED(o))
 {
   close_and_free_everything(NULL,THIS);
 }
 
-static void exit_output_struct(struct object *obj)
+static void exit_output_struct(struct object *UNUSED(obj))
 {
   struct output *o;
   
@@ -1310,7 +1310,7 @@ static void exit_output_struct(struct object *obj)
   }
 }
 
-static void init_output_struct(struct object *ob)
+static void init_output_struct(struct object *UNUSED(ob))
 {
   struct output *o;
   debug_malloc_touch(ob);
diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c
index 2596966455..b955d9285c 100644
--- a/src/modules/Postgres/pgresult.c
+++ b/src/modules/Postgres/pgresult.c
@@ -121,16 +121,16 @@ extern PIKE_MUTEX_T pike_postgres_mutex;
 #ifdef PGRESDEBUG
 #define pgdebug printf
 #else
-static void pgdebug (char * a, ...) {}
+static void pgdebug (char * UNUSED(a), ...) {}
 #endif
 
-void result_create (struct object * o) {
+void result_create (struct object * UNUSED(o)) {
 	pgdebug("result_create().\n");
 	THIS->result=NULL;
 	THIS->cursor=0;
 }
 
-void result_destroy (struct object * o) {
+void result_destroy (struct object * UNUSED(o)) {
 	pgdebug("result_destroy().\n");
 	if(THIS->pgod->docommit) {
 	  PGconn * conn = THIS->pgod->dblink;
diff --git a/src/modules/Postgres/postgres.c b/src/modules/Postgres/postgres.c
index b625d01517..01e2f8f762 100644
--- a/src/modules/Postgres/postgres.c
+++ b/src/modules/Postgres/postgres.c
@@ -67,7 +67,7 @@ PIKE_MUTEX_T pike_postgres_mutex STATIC_MUTEX_INIT;
 #ifdef PGDEBUG
 #define pgdebug printf
 #else
-static void pgdebug (char * a, ...) {}
+static void pgdebug (char * UNUSED(a), ...) {}
 #endif
 
 struct program * postgres_program;
@@ -81,7 +81,7 @@ static void set_error (char * newerror)
 	return;
 }
 
-static void pgres_create (struct object * o) {
+static void pgres_create (struct object * UNUSED(o)) {
 	pgdebug ("pgres_create().\n");
 	THIS->dblink=NULL;
 	THIS->last_error=NULL;
@@ -96,7 +96,7 @@ static void pgres_create (struct object * o) {
 
 }
 
-static void pgres_destroy (struct object * o)
+static void pgres_destroy (struct object * UNUSED(o))
 {
 	PGconn * conn;
 	PQ_FETCH();
diff --git a/src/modules/Regexp/glue.c b/src/modules/Regexp/glue.c
index b9c731c0b5..95c581779b 100644
--- a/src/modules/Regexp/glue.c
+++ b/src/modules/Regexp/glue.c
@@ -213,12 +213,12 @@ static void regexp_split(INT32 args)
   }
 }
 
-static void init_regexp_glue(struct object *o)
+static void init_regexp_glue(struct object *UNUSED(o))
 {
   THIS->regexp=0;
 }
 
-static void exit_regexp_glue(struct object *o)
+static void exit_regexp_glue(struct object *UNUSED(o))
 {
   do_free();
 }
diff --git a/src/modules/Yp/yp.c b/src/modules/Yp/yp.c
index 4e44874876..ab79fbfdc4 100644
--- a/src/modules/Yp/yp.c
+++ b/src/modules/Yp/yp.c
@@ -280,13 +280,13 @@ static void f_match(INT32 args)
   push_string(make_shared_binary_string( retval, retlen ));
 }
 
-static void init_yp_struct( struct object *o )
+static void init_yp_struct( struct object *UNUSED(o) )
 {
   this->domain = 0;
   this->last_size = 0;
 }
 
-static void exit_yp_struct( struct object *o )
+static void exit_yp_struct( struct object *UNUSED(o) )
 {
   if(this->domain)
   {
diff --git a/src/modules/_Charset/charsetmod.c b/src/modules/_Charset/charsetmod.c
index d426215538..1dc2d4a1c6 100644
--- a/src/modules/_Charset/charsetmod.c
+++ b/src/modules/_Charset/charsetmod.c
@@ -386,7 +386,7 @@ static void f_clear(INT32 args)
   push_object(this_object());
 }
 
-static void init_stor(struct object *o)
+static void init_stor(struct object *UNUSED(o))
 {
   struct std_cs_stor *s = (struct std_cs_stor *)fp->current_storage;
 
@@ -396,7 +396,7 @@ static void init_stor(struct object *o)
   init_string_builder(&s->strbuild,0);
 }
 
-static void exit_stor(struct object *o)
+static void exit_stor(struct object *UNUSED(o))
 {
   struct std_cs_stor *s = (struct std_cs_stor *)fp->current_storage;
 
@@ -756,7 +756,7 @@ static void f_clear_utf7(INT32 args)
   u7->datbit = 0;
 }
 
-static void utf7_init_stor(struct object *o)
+static void utf7_init_stor(struct object *UNUSED(o))
 {
   struct utf7_stor *u7 =
     (struct utf7_stor *)(fp->current_storage+utf7_stor_offs);
@@ -2243,7 +2243,7 @@ static void f_drain_utf7e(INT32 args)
   f_drain(args);
 }
 
-static void std_8bite_init_stor(struct object *o)
+static void std_8bite_init_stor(struct object *UNUSED(o))
 {
   struct std8e_stor *s8 =
     (struct std8e_stor *)(fp->current_storage+std8e_stor_offs);
@@ -2255,7 +2255,7 @@ static void std_8bite_init_stor(struct object *o)
   s8->zero_char = 0xfffd;
 }
 
-static void std_8bite_exit_stor(struct object *o)
+static void std_8bite_exit_stor(struct object *UNUSED(o))
 {
   struct std8e_stor *s8 =
     (struct std8e_stor *)(fp->current_storage+std8e_stor_offs);
@@ -2339,7 +2339,7 @@ static void f_feed_std8e(INT32 args)
   push_object(this_object());
 }
 
-static void std_16bite_init_stor(struct object *o)
+static void std_16bite_init_stor(struct object *UNUSED(o))
 {
   struct std16e_stor *s16 =
     (struct std16e_stor *)(fp->current_storage+std16e_stor_offs);
@@ -2351,7 +2351,7 @@ static void std_16bite_init_stor(struct object *o)
   s16->sshift = 0;
 }
 
-static void std_16bite_exit_stor(struct object *o)
+static void std_16bite_exit_stor(struct object *UNUSED(o))
 {
   struct std16e_stor *s16 =
     (struct std16e_stor *)(fp->current_storage+std16e_stor_offs);
diff --git a/src/modules/_Charset/iso2022.c b/src/modules/_Charset/iso2022.c
index c185e29a86..1a19e18b80 100644
--- a/src/modules/_Charset/iso2022.c
+++ b/src/modules/_Charset/iso2022.c
@@ -1488,7 +1488,7 @@ static void f_set_repcb(INT32 args)
   pop_n_elems(args);
 }
 
-static void init_stor(struct object *o)
+static void init_stor(struct object *UNUSED(o))
 {
   struct iso2022_stor *s = (struct iso2022_stor *)fp->current_storage;
 
@@ -1500,7 +1500,7 @@ static void init_stor(struct object *o)
   pop_n_elems(1);
 }
 
-static void exit_stor(struct object *o)
+static void exit_stor(struct object *UNUSED(o))
 {
   struct iso2022_stor *s = (struct iso2022_stor *)fp->current_storage;
 
@@ -1512,7 +1512,7 @@ static void exit_stor(struct object *o)
   free_string_builder(&s->strbuild);
 }
 
-static void init_enc_stor(struct object *o)
+static void init_enc_stor(struct object *UNUSED(o))
 {
   struct iso2022enc_stor *s = (struct iso2022enc_stor *)fp->current_storage;
   int i;
@@ -1527,7 +1527,7 @@ static void init_enc_stor(struct object *o)
   pop_n_elems(1);
 }
 
-static void exit_enc_stor(struct object *o)
+static void exit_enc_stor(struct object *UNUSED(o))
 {
   struct iso2022enc_stor *s = (struct iso2022enc_stor *)fp->current_storage;
   int i;
diff --git a/src/modules/_Image_FreeType/freetype.c b/src/modules/_Image_FreeType/freetype.c
index 0a24bea224..7a53e7f82f 100644
--- a/src/modules/_Image_FreeType/freetype.c
+++ b/src/modules/_Image_FreeType/freetype.c
@@ -100,12 +100,12 @@ static void image_ft_error(const char *msg, FT_Error errcode)
  *! A FreeType font face. We recommend using the more generic font handling
  *! interfaces in @[Image.Fonts] instead.
  */
-static void image_ft_face_init( struct object *o )
+static void image_ft_face_init( struct object *UNUSED(o) )
 {
   TFACE = NULL;
 }
 
-static void image_ft_face_free( struct object *o )
+static void image_ft_face_free( struct object *UNUSED(o) )
 {
   FT_Done_Face( TFACE );
 }
diff --git a/src/modules/_Image_JPEG/image_jpeg.c b/src/modules/_Image_JPEG/image_jpeg.c
index d65799df2f..65b324df3f 100644
--- a/src/modules/_Image_JPEG/image_jpeg.c
+++ b/src/modules/_Image_JPEG/image_jpeg.c
@@ -118,7 +118,7 @@ static const int reverse_quality[101]=
  *!	Independent JPEG Group.
  */
 
-static void my_output_message(struct jpeg_common_struct *cinfo)
+static void my_output_message(struct jpeg_common_struct *UNUSED(cinfo))
 {
    /* no message */
    /* (this should not be called) */
@@ -133,7 +133,7 @@ static void my_error_exit(struct jpeg_common_struct *cinfo)
    Pike_error("Image.JPEG: fatal error in libjpeg; %s\n",buffer);
 }
 
-static void my_emit_message(struct jpeg_common_struct *cinfo,int msg_level)
+static void my_emit_message(struct jpeg_common_struct *UNUSED(cinfo), int UNUSED(msg_level))
 {
    /* no trace */
 }
@@ -253,7 +253,7 @@ static boolean my_empty_output_buffer(struct jpeg_compress_struct *cinfo)
    return TRUE;
 }
 
-static void my_term_destination(struct jpeg_compress_struct *cinfo)
+static void my_term_destination(struct jpeg_compress_struct *UNUSED(cinfo))
 {
    /* don't do anything */
 }
@@ -493,7 +493,7 @@ static void my_skip_input_data(struct jpeg_decompress_struct *cinfo,
    sm->pub.bytes_in_buffer -= (size_t) num_bytes;
 }
 
-static void my_term_source(struct jpeg_decompress_struct *cinfo)
+static void my_term_source(struct jpeg_decompress_struct *UNUSED(cinfo))
 {
    /* nop */
 }
diff --git a/src/modules/_Image_JPEG/transupp.c b/src/modules/_Image_JPEG/transupp.c
index 5abfde21eb..0510eece64 100644
--- a/src/modules/_Image_JPEG/transupp.c
+++ b/src/modules/_Image_JPEG/transupp.c
@@ -1616,7 +1616,7 @@ jcopy_markers_setup (j_decompress_ptr srcinfo, JCOPY_OPTION option)
 
 GLOBAL(void)
 jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
-		       JCOPY_OPTION option)
+		       JCOPY_OPTION UNUSED(option))
 {
   jpeg_saved_marker_ptr marker;
 
diff --git a/src/modules/_Image_TIFF/image_tiff.c b/src/modules/_Image_TIFF/image_tiff.c
index 2c54cf4380..531a26a3a7 100644
--- a/src/modules/_Image_TIFF/image_tiff.c
+++ b/src/modules/_Image_TIFF/image_tiff.c
@@ -942,9 +942,9 @@ static void image_tiff_encode( INT32 args )
 
 
 /* Complies with the TIFFErrorHandler API */
-void my_tiff_warning_handler(const char *module, const char *fmt, va_list x){}
+void my_tiff_warning_handler(const char *UNUSED(module), const char *UNUSED(fmt), va_list UNUSED(x)){}
 /* Complies with the TIFFErrorHandler API */
-void my_tiff_error_handler(const char *module, const char *fmt, va_list x)
+void my_tiff_error_handler(const char *UNUSED(module), const char *fmt, va_list x)
 {
 #ifdef HAVE_VSNPRINTF
   vsnprintf(last_tiff_error, TIFF_ERROR_BUF_SIZE-1, fmt, x);
diff --git a/src/modules/_Protocols_DNS_SD/sd.c b/src/modules/_Protocols_DNS_SD/sd.c
index e7500c01cd..9da9dab5e8 100644
--- a/src/modules/_Protocols_DNS_SD/sd.c
+++ b/src/modules/_Protocols_DNS_SD/sd.c
@@ -118,13 +118,13 @@ static void raise_error(char *msg, DNSServiceErrorType err)
 }
 
 
-static void start_service_callback(DNSServiceRef ref,
-				   DNSServiceFlags flags,
-				   DNSServiceErrorType error,
-				   const char *name,
-				   const char *regtype,
-				   const char *domain,
-				   void *context)
+static void start_service_callback(DNSServiceRef UNUSED(ref),
+				   DNSServiceFlags UNUSED(flags),
+				   DNSServiceErrorType UNUSED(error),
+				   const char *UNUSED(name),
+				   const char *UNUSED(regtype),
+				   const char *UNUSED(domain),
+				   void *UNUSED(context))
 {
 }
 
@@ -370,13 +370,13 @@ static void f_create(INT32 args)
 }
 
 
-static void init_service_struct(struct object *o)
+static void init_service_struct(struct object *UNUSED(o))
 {
   THIS->service_ref = 0;
 }
 
 
-static void exit_service_struct(struct object *o)
+static void exit_service_struct(struct object *UNUSED(o))
 {
   /* Stop an existing service */
   stop_service(THIS);
diff --git a/src/modules/_Roxen/roxen.c b/src/modules/_Roxen/roxen.c
index 36bcf2f535..6ae6653a74 100644
--- a/src/modules/_Roxen/roxen.c
+++ b/src/modules/_Roxen/roxen.c
@@ -55,7 +55,7 @@ struct  header_buf
   int mode;
 };
 
-static void f_hp_init( struct object *o )
+static void f_hp_init( struct object *UNUSED(o) )
 {
   THP->headers = NULL;
   THP->pnt = NULL;
@@ -65,7 +65,7 @@ static void f_hp_init( struct object *o )
   THP->mode = 0;
 }
 
-static void f_hp_exit( struct object *o )
+static void f_hp_exit( struct object *UNUSED(o) )
 {
   if( THP->headers )
     free( THP->headers );
diff --git a/src/modules/_WhiteFish/blobs.c b/src/modules/_WhiteFish/blobs.c
index 49bb7a4d14..60da31bfa7 100644
--- a/src/modules/_WhiteFish/blobs.c
+++ b/src/modules/_WhiteFish/blobs.c
@@ -210,7 +210,7 @@ static int compare_wordarrays( const void *_a, const void *_b )
  *! the blobs struct once. Also, once you have called @[read] or @[read_all_sorted],
  *! @[add_words] will no longer work as expected.
  */
-static void f_blobs_read_all_sorted( INT32 args )
+static void f_blobs_read_all_sorted( INT32 UNUSED(args) )
 {
   struct array *g = allocate_array( THIS->nwords );
   int i;
diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 638eb26ea3..6cf9dc31e8 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -1230,7 +1230,7 @@ static int writev_fds(int fd, struct iovec *iov, int iovcnt,
 
 #endif /* HAVE_PIKE_SEND_FD */
 
-static struct pike_string *do_read_oob(int fd,
+static struct pike_string *do_read_oob(int UNUSED(fd),
 				       INT32 r,
 				       int all,
 				       int *err)
@@ -4331,7 +4331,7 @@ static void file_handle_events(int event)
 }
 
 
-static void low_dup(struct object *toob,
+static void low_dup(struct object *UNUSED(toob),
 		    struct my_file *to,
 		    struct my_file *from)
 {
@@ -5314,7 +5314,7 @@ static void file_trylock(INT32 args)
 #endif
 
 #define THIS_KEY ((struct file_lock_key_storage *)(Pike_fp->current_storage))
-static void init_file_lock_key(struct object *o)
+static void init_file_lock_key(struct object *UNUSED(o))
 {
   THIS_KEY->f=0;
 #ifdef _REENTRANT
@@ -5323,7 +5323,7 @@ static void init_file_lock_key(struct object *o)
 #endif
 }
 
-static void exit_file_lock_key(struct object *o)
+static void exit_file_lock_key(struct object *DEBUGUSED(o))
 {
   if(THIS_KEY->f)
   {
@@ -5693,7 +5693,7 @@ PIKE_MODULE_EXIT
 
 #include "file_functions.h"
 
-static void file___init_ref(struct object *o)
+static void file___init_ref(struct object *UNUSED(o))
 {
   SET_SVAL(REF, PIKE_T_OBJECT, 0, object, file_make_object_from_fd(-1, 0, 0));
 }
diff --git a/src/modules/files/sendfile.c b/src/modules/files/sendfile.c
index 8533a857f5..ce21cb59d0 100644
--- a/src/modules/files/sendfile.c
+++ b/src/modules/files/sendfile.c
@@ -157,7 +157,7 @@ static struct program *pike_sendfile_prog = NULL;
  * Struct init code.
  */
 
-static void init_pike_sendfile(struct object *o)
+static void init_pike_sendfile(struct object *UNUSED(o))
 {
   MEMSET(THIS, 0, sizeof(struct pike_sendfile));
 
@@ -168,7 +168,7 @@ static void init_pike_sendfile(struct object *o)
   SET_SVAL(THIS->callback, T_INT, NUMBER_NUMBER, integer, 0);
 }
 
-static void exit_pike_sendfile(struct object *o)
+static void exit_pike_sendfile(struct object *UNUSED(o))
 {
   SF_DFPRINTF((stderr, "sendfile: Exiting...\n"));
 
@@ -268,7 +268,7 @@ static void sf_call_callback(struct pike_sendfile *this)
   }
 }
 
-static void call_callback_and_free(struct callback *cb, void *this_, void *arg)
+static void call_callback_and_free(struct callback *cb, void *this_, void *UNUSED(arg))
 {
   struct pike_sendfile *this = this_;
 
diff --git a/src/modules/files/socket.c b/src/modules/files/socket.c
index 9f26ed36f3..8b70981660 100644
--- a/src/modules/files/socket.c
+++ b/src/modules/files/socket.c
@@ -84,7 +84,7 @@ struct port
 #undef THIS
 #define THIS ((struct port *)(Pike_fp->current_storage))
 
-static int got_port_event (struct fd_callback_box *box, int event)
+static int got_port_event (struct fd_callback_box *box, int DEBUGUSED(event))
 {
   struct port *p = (struct port *) box;
 #ifdef PIKE_DEBUG
@@ -705,7 +705,7 @@ static void init_port_struct(struct object *o)
   /* map_variable takes care of id and accept_callback. */
 }
 
-static void exit_port_struct(struct object *o)
+static void exit_port_struct(struct object *UNUSED(o))
 {
   do_close(THIS);
   unhook_fd_callback_box (&THIS->box);
diff --git a/src/modules/files/stat.c b/src/modules/files/stat.c
index b29e0855b4..93c2c87e90 100644
--- a/src/modules/files/stat.c
+++ b/src/modules/files/stat.c
@@ -292,7 +292,7 @@ static void stat_push_compat(INT_TYPE n)
    }
 }
 
-static void stat_init (struct object *o)
+static void stat_init (struct object *UNUSED(o))
 {
   MEMSET ((char *) &THIS_STAT->s, 0, sizeof (THIS_STAT->s));
 }
diff --git a/src/modules/files/udp.c b/src/modules/files/udp.c
index 071ed5ea0a..81d6993b43 100644
--- a/src/modules/files/udp.c
+++ b/src/modules/files/udp.c
@@ -144,7 +144,7 @@ struct udp_storage {
 
 void zero_udp(struct object *ignored);
 int low_exit_udp(void);
-void exit_udp(struct object *ignored) {
+void exit_udp(struct object *UNUSED(ignored)) {
   low_exit_udp();
 }
 
@@ -811,7 +811,7 @@ void udp_sendto(INT32 args)
 }
 
 
-static int got_udp_event (struct fd_callback_box *box, int event)
+static int got_udp_event (struct fd_callback_box *box, int DEBUGUSED(event))
 {
   struct udp_storage *u = (struct udp_storage *) box;
 #ifdef PIKE_DEBUG
diff --git a/src/modules/system/memory.c b/src/modules/system/memory.c
index 955b9f736c..4807557345 100644
--- a/src/modules/system/memory.c
+++ b/src/modules/system/memory.c
@@ -106,7 +106,7 @@ static void memory_shm(INT32 args);
 #define THISOBJ (Pike_fp->current_object)
 #define THIS ((struct memory_storage *)(Pike_fp->current_storage))
 
-static void init_memory(struct object *o)
+static void init_memory(struct object *UNUSED(o))
 {
    THIS->p=NULL;
    THIS->size=0;
@@ -142,7 +142,7 @@ static void MEMORY_FREE( struct memory_storage *storage )
    if (!(STORAGE->p))							\
       Pike_error("%s: no memory in this Memory object\n",FUNC);
 
-static void exit_memory(struct object *o)
+static void exit_memory(struct object *UNUSED(o))
 {
    MEMORY_FREE(THIS);
 }
diff --git a/src/multiset.c b/src/multiset.c
index 50a64922b2..35555b33c5 100644
--- a/src/multiset.c
+++ b/src/multiset.c
@@ -4339,7 +4339,7 @@ PMOD_EXPORT ptrdiff_t multiset_get_nth (struct multiset *l, size_t n)
 #define GC_MSD_GOT_NODE_REFS GC_USER_3
 
 static void visit_multiset_data (struct multiset_data *msd, int action,
-				 struct multiset *l)
+				 struct multiset *UNUSED(l))
 {
   switch (action) {
 #ifdef PIKE_DEBUG
diff --git a/src/object.c b/src/object.c
index 0a4770b4a5..691fe6609c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -515,7 +515,7 @@ static struct pike_string *low_read_file(const char *file)
   return 0;
 }
 
-static void get_master_cleanup (void *dummy)
+static void get_master_cleanup (void *UNUSED(dummy))
 {
   if (master_object) {
     free_object (master_object);
diff --git a/src/operators.c b/src/operators.c
index d8e27e99ac..21784e3f7c 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -5657,14 +5657,14 @@ static void f_string_assignment_assign_index(INT32 args)
 }
 
 
-static void init_string_assignment_storage(struct object *o)
+static void init_string_assignment_storage(struct object *UNUSED(o))
 {
   SET_SVAL(THIS->lval[0], T_INT, PIKE_T_FREE, integer, 0);
   SET_SVAL(THIS->lval[1], T_INT, PIKE_T_FREE, integer, 0);
   THIS->s = NULL;
 }
 
-static void exit_string_assignment_storage(struct object *o)
+static void exit_string_assignment_storage(struct object *UNUSED(o))
 {
   free_svalues(THIS->lval, 2, BIT_MIXED);
   if(THIS->s)
diff --git a/src/pike_embed.c b/src/pike_embed.c
index e0224ab8ed..0b51d894b4 100644
--- a/src/pike_embed.c
+++ b/src/pike_embed.c
@@ -430,7 +430,7 @@ void init_pike_runtime(void (*exit_cb)(int))
 /* FIXME: Thread specific limit? */
 static unsigned long instructions_left = 0;
 
-static void time_to_exit(struct callback *cb,void *tmp,void *ignored)
+static void time_to_exit(struct callback *UNUSED(cb), void *UNUSED(tmp), void *UNUSED(ignored))
 {
   if(!(instructions_left--))
   {
diff --git a/src/pike_search.c b/src/pike_search.c
index 154d83329a..561dd0016b 100644
--- a/src/pike_search.c
+++ b/src/pike_search.c
@@ -33,9 +33,9 @@ static struct mapping *memsearch_cache;
 static struct program *pike_search_program;
 
 
-static void *nil_search(void *no_data,
+static void *nil_search(void *UNUSED(no_data),
 			void *haystack,
-			ptrdiff_t haystacklen)
+			ptrdiff_t UNUSED(haystacklen))
 {
   return haystack;
 }
@@ -43,9 +43,9 @@ static void *nil_search(void *no_data,
 /* Needed on architectures where struct returns have
  * incompatible calling conventions (sparc v8).
  */
-static PCHARP nil_searchN(void *no_data,
+static PCHARP nil_searchN(void *UNUSED(no_data),
 			  PCHARP haystack,
-			  ptrdiff_t haystacklen)
+			  ptrdiff_t UNUSED(haystacklen))
 {
   return haystack;
 }
diff --git a/src/post_modules/Bz2/libbzip2mod.cmod b/src/post_modules/Bz2/libbzip2mod.cmod
index 44ebf56fb9..04f45224af 100644
--- a/src/post_modules/Bz2/libbzip2mod.cmod
+++ b/src/post_modules/Bz2/libbzip2mod.cmod
@@ -280,7 +280,7 @@ PIKECLASS Deflate
   }
   
   void do_deflate(struct pike_string *data, dynamic_buffer *retbuf,
-		  int mode, INT32 args){
+		  int mode, INT32 UNUSED(args)){
     char *tmp = NULL;
     int retval;
     int total_out_old = 0;
diff --git a/src/post_modules/GSSAPI/gssapi.cmod b/src/post_modules/GSSAPI/gssapi.cmod
index 9d136f8926..4d3683d68a 100644
--- a/src/post_modules/GSSAPI/gssapi.cmod
+++ b/src/post_modules/GSSAPI/gssapi.cmod
@@ -952,7 +952,7 @@ static DECLSPEC(noreturn) void throw_gssapi_error (
 }
 
 static DECLSPEC(noreturn) void handle_error (
-  int line, const char *gss_func,
+  int DEBUGUSED(line), const char *DEBUGUSED(gss_func),
   OM_uint32 major, OM_uint32 minor, const gss_OID mech
 )
 /* Assumed to be called only if GSS_ERROR (maj) is true. */
diff --git a/src/post_modules/Nettle/cipher.cmod b/src/post_modules/Nettle/cipher.cmod
index 41afbfe339..3712ca9f3e 100644
--- a/src/post_modules/Nettle/cipher.cmod
+++ b/src/post_modules/Nettle/cipher.cmod
@@ -332,7 +332,7 @@ PIKECLASS CipherState
 static void
 pike_aes_set_encrypt_key(void *ctx,
 			 ptrdiff_t length, const char *key,
-			 int force)
+			 int UNUSED(force))
 {
   if (length == 16 || length == 24 || length == 32)
     aes_set_encrypt_key(ctx, length, (const uint8_t *)key);
@@ -343,7 +343,7 @@ pike_aes_set_encrypt_key(void *ctx,
 static void
 pike_aes_set_decrypt_key(void *ctx,
 			 ptrdiff_t length, const char *key,
-			 int force)
+			 int UNUSED(force))
 {
   if (length == 16 || length == 24 || length == 32)
     aes_set_decrypt_key(ctx, length, (const uint8_t *)key);
@@ -360,7 +360,7 @@ pike_aes_set_decrypt_key(void *ctx,
 static void
 pike_arcfour_set_key(void *ctx,
 		     ptrdiff_t length, const char *key,
-		     int force)
+		     int UNUSED(force))
 {
   if (length < ARCFOUR_MIN_KEY_SIZE || length > ARCFOUR_MAX_KEY_SIZE)
     Pike_error("ARCFOUR_Info: Bad keysize for ARCFOUR.\n");
@@ -384,7 +384,7 @@ pike_arcfour_set_key(void *ctx,
 static void
 pike_blowfish_set_key(void *ctx,
 		      ptrdiff_t length, const char *key,
-		      int force)
+		      int UNUSED(force))
 {
   if (length < BLOWFISH_MIN_KEY_SIZE || length > BLOWFISH_MAX_KEY_SIZE)
     Pike_error("BLOWFISH_Info: Bad keysize for BLOWFISH.\n");
@@ -407,7 +407,7 @@ pike_blowfish_set_key(void *ctx,
 static void
 pike_camellia_set_encrypt_key(void *ctx,
 			      ptrdiff_t length, const char *key,
-			      int force)
+			      int UNUSED(force))
 {
   if (length < CAMELLIA_MIN_KEY_SIZE || length > CAMELLIA_MAX_KEY_SIZE)
     Pike_error("CAMELLIA_Info: Bad keysize for CAMELLIA.\n");
@@ -438,7 +438,7 @@ pike_camellia_set_decrypt_key(void *ctx,
 static void
 pike_cast128_set_key(void *ctx,
 		     ptrdiff_t length, const char *key,
-		     int force)
+		     int UNUSED(force))
 {
   if (length < CAST128_MIN_KEY_SIZE || length > CAST128_MAX_KEY_SIZE)
     Pike_error("CAST128_info: Bad keysize for CAST128.\n");
@@ -780,7 +780,7 @@ PIKECLASS DES3_State
 static void
 pike_serpent_set_key(void *ctx,
 		     ptrdiff_t length, const char *key,
-		     int force)
+		     int UNUSED(force))
 {
   if (length < SERPENT_MIN_KEY_SIZE || length > SERPENT_MAX_KEY_SIZE)
     Pike_error("SERPENT_Info: Bad keysize for SERPENT.\n");
@@ -801,7 +801,7 @@ pike_serpent_set_key(void *ctx,
 static void
 pike_twofish_set_key(void *ctx,
 		     ptrdiff_t length, const char *key,
-		     int force)
+		     int UNUSED(force))
 {
   if (length < TWOFISH_MIN_KEY_SIZE || length > TWOFISH_MAX_KEY_SIZE)
     Pike_error("TWOFISH_Info: Bad keysize for TWOFISH.\n");
@@ -825,7 +825,7 @@ pike_twofish_set_key(void *ctx,
 static void
 pike_idea_set_encrypt_key(void *ctx_v,
 			 ptrdiff_t length, const char *key,
-			 int force)
+			 int UNUSED(force))
 {
   struct idea_ctx *ctx = ctx_v;
   if (length == IDEA_KEY_SIZE)
@@ -837,7 +837,7 @@ pike_idea_set_encrypt_key(void *ctx_v,
 static void
 pike_idea_set_decrypt_key(void *ctx_v,
 			 ptrdiff_t length, const char *key,
-			 int force)
+			 int UNUSED(force))
 {
   struct idea_ctx *ctx = ctx_v;
   if (length == IDEA_KEY_SIZE) {
diff --git a/src/post_modules/Shuffler/Shuffler.cmod b/src/post_modules/Shuffler/Shuffler.cmod
index 766a7fba85..6b18b603ac 100644
--- a/src/post_modules/Shuffler/Shuffler.cmod
+++ b/src/post_modules/Shuffler/Shuffler.cmod
@@ -144,7 +144,7 @@ PIKECLASS Shuffle
     }
   }
 
-  static int got_shuffler_event(struct fd_callback_box*box, int event) {
+  static int got_shuffler_event(struct fd_callback_box*box, int DEBUGUSED(event)) {
 #ifdef PIKE_DEBUG
     if (event != PIKE_FD_WRITE)
       Pike_fatal ("Got unexpected event %d.\n", event);
diff --git a/src/post_modules/Shuffler/c_source_stream.c b/src/post_modules/Shuffler/c_source_stream.c
index e980726cdb..89ee5f0e64 100644
--- a/src/post_modules/Shuffler/c_source_stream.c
+++ b/src/post_modules/Shuffler/c_source_stream.c
@@ -59,7 +59,7 @@ static void remove_callbacks( struct source *src )
 }
 
 
-static struct data get_data( struct source *src, off_t len )
+static struct data get_data( struct source *src, off_t UNUSED(len) )
 {
   struct fd_source *s = (struct fd_source *)src;
   struct data res;
@@ -93,7 +93,7 @@ static void free_source( struct source *src )
   free_object(((struct fd_source *)src)->obj);
 }
 
-static void read_callback( int fd, struct fd_source *s )
+static void read_callback( int UNUSED(fd), struct fd_source *s )
 {
   int l;
   remove_callbacks( (struct source *)s );
diff --git a/src/post_modules/Unicode/normalize.c b/src/post_modules/Unicode/normalize.c
index 27418b73cf..579a3fb8fc 100644
--- a/src/post_modules/Unicode/normalize.c
+++ b/src/post_modules/Unicode/normalize.c
@@ -253,7 +253,7 @@ struct buffer *unicode_decompose_buffer( struct buffer *source,	int how )
   return res;
 }
 
-struct buffer *unicode_compose_buffer( struct buffer *source, int how )
+struct buffer *unicode_compose_buffer( struct buffer *source, int UNUSED(how) )
 {
   int startch = source->data[0];
   int lastclass = get_canonical_class( startch )?256:0;
diff --git a/src/program.c b/src/program.c
index 27f133d5be..d17096d7cb 100644
--- a/src/program.c
+++ b/src/program.c
@@ -5181,7 +5181,7 @@ PMOD_EXPORT int quick_map_variable(const char *name,
 		       int name_length,
 		       size_t offset,
 		       const char *type,
-		       int type_length,
+		       int UNUSED(type_length),
 		       INT32 run_time_type,
 		       INT32 flags)
 {
@@ -6490,7 +6490,7 @@ int store_prog_string(struct pike_string *str)
 /* NOTE: O(n�)! */
 int store_constant(const struct svalue *foo,
 		   int equal,
-		   struct pike_string *constant_name)
+		   struct pike_string *UNUSED(constant_name))
 {
   struct program_constant tmp;
   volatile unsigned int e;
@@ -9724,7 +9724,7 @@ PMOD_EXPORT void exit_compiler(void)
 
 #define THIS_PROGRAM_STATE  ((struct program_state *)(Pike_fp->current_storage))
 
-static void program_state_event_handler(int event)
+static void program_state_event_handler(int UNUSED(event))
 {
 #if 0
   struct program_state *c = THIS_PROGRAM_STATE;
@@ -10152,7 +10152,7 @@ PMOD_EXPORT int quick_add_function(const char *name,
 				   int name_length,
 				   void (*cfun)(INT32),
 				   const char *type,
-				   int type_length,
+				   int UNUSED(type_length),
 				   unsigned flags,
 				   unsigned opt_flags)
 {
@@ -10218,7 +10218,7 @@ void check_all_programs(void)
 #define THIS ((struct pike_trampoline *)(CURRENT_STORAGE))
 struct program *pike_trampoline_program=0;
 
-static void apply_trampoline(INT32 args)
+static void apply_trampoline(INT32 UNUSED(args))
 {
   Pike_error("Internal error: Trampoline magic failed!\n");
 }
@@ -10256,12 +10256,12 @@ static void sprintf_trampoline (INT32 args)
   free (str.str);
 }
 
-static void init_trampoline(struct object *o)
+static void init_trampoline(struct object *UNUSED(o))
 {
   THIS->frame=0;
 }
 
-static void exit_trampoline(struct object *o)
+static void exit_trampoline(struct object *UNUSED(o))
 {
   if(THIS->frame)
   {
@@ -10284,7 +10284,7 @@ static void gc_check_frame(struct pike_frame *f)
   }
 }
 
-static void gc_check_trampoline(struct object *o)
+static void gc_check_trampoline(struct object *UNUSED(o))
 {
   if (THIS->frame &&
       !debug_gc_check (THIS->frame, " as trampoline frame"))
@@ -10300,7 +10300,7 @@ static void gc_recurse_frame(struct pike_frame *f)
   if(f->scope)          gc_recurse_frame(f->scope);
 }
 
-static void gc_recurse_trampoline(struct object *o)
+static void gc_recurse_trampoline(struct object *UNUSED(o))
 {
   if (THIS->frame) gc_recurse_frame(THIS->frame);
 }
diff --git a/src/signal_handler.c b/src/signal_handler.c
index d187adf190..830175d724 100644
--- a/src/signal_handler.c
+++ b/src/signal_handler.c
@@ -710,9 +710,8 @@ void process_done(pid_t pid, const char *from)
 
 #else
 
-#define process_started(PID)
-#define process_done(PID,FROM)
-#define dump_process_history(PID)
+void process_started(pid_t UNUSED(pid)) { }
+void process_done(pid_t UNUSED(pid), const char *UNUSED(from)) { }
 
 #endif /* PIKE_DEBUG */
 
@@ -794,9 +793,9 @@ void my_signal(int sig, sigfunctype fun)
 
 static int signalling=0;
 
-static void unset_signalling(void *notused) { signalling=0; }
+static void unset_signalling(void *UNUSED(notused)) { signalling=0; }
 
-PMOD_EXPORT void check_signals(struct callback *foo, void *bar, void *gazonk)
+PMOD_EXPORT void check_signals(struct callback *UNUSED(foo), void *UNUSED(bar), void *UNUSED(gazonk))
 {
   ONERROR ebuf;
 #ifdef PIKE_DEBUG
@@ -1228,7 +1227,7 @@ struct pid_status
 
 static struct program *pid_status_program=0;
 
-static void init_pid_status(struct object *o)
+static void init_pid_status(struct object *UNUSED(o))
 {
   THIS->pid=-1;
 #ifdef __NT__
@@ -1242,7 +1241,7 @@ static void init_pid_status(struct object *o)
 #endif
 }
 
-static void exit_pid_status(struct object *o)
+static void exit_pid_status(struct object *UNUSED(o))
 {
 #ifdef USE_PID_MAPPING
   if(pid_mapping)
@@ -1259,7 +1258,7 @@ static void exit_pid_status(struct object *o)
 }
 
 #ifdef USE_PID_MAPPING
-static void call_pid_status_callback(struct callback *cb, void *pid, void *arg)
+static void call_pid_status_callback(struct callback *cb, void *pid, void *UNUSED(arg))
 {
   struct object *o = pid;
   struct pid_status *p;
@@ -1389,7 +1388,7 @@ static void do_bi_do_da_lock(void)
   mt_unlock(&wait_thread_mutex);
 }
 
-static TH_RETURN_TYPE wait_thread(void *data)
+static TH_RETURN_TYPE wait_thread(void *UNUSED(data))
 {
   if(th_atfork(do_da_lock,do_bi_do_da_lock,0))
   {
@@ -1828,12 +1827,12 @@ static void f_pid_status_set_priority(INT32 args)
  *     pid_status_program is inherited first.
  */
 
-static void init_trace_process(struct object *o)
+static void init_trace_process(struct object *UNUSED(o))
 {
   THIS->flags |= PROCESS_FLAG_TRACED;
 }
 
-static void exit_trace_process(struct object *o)
+static void exit_trace_process(struct object *UNUSED(o))
 {
   /* FIXME: Detach the process? */
 }
@@ -2453,7 +2452,7 @@ void f_set_priority( INT32 args )
 #ifndef __amigaos__
 #ifdef HAVE_SETRLIMIT
 static void internal_add_limit( struct perishables *storage, 
-                                char *limit_name,
+                                char *UNUSED(limit_name),
                                 int limit_resource,
                                 struct svalue *limit_value )
 {
@@ -4767,7 +4766,7 @@ static RETSIGTYPE fatal_signal(int signum)
 
 static struct array *atexit_functions;
 
-static void run_atexit_functions(struct callback *cb, void *arg,void *arg2)
+static void run_atexit_functions(struct callback *UNUSED(cb), void *UNUSED(arg),void *UNUSED(arg2))
 {
   if(atexit_functions)
   {
diff --git a/src/svalue.c b/src/svalue.c
index 0cb0b68230..8848d8c9e4 100644
--- a/src/svalue.c
+++ b/src/svalue.c
@@ -262,7 +262,7 @@ PMOD_EXPORT void debug_free_svalues(struct svalue *s, size_t num, INT32 type_hin
   }
 }
 
-PMOD_EXPORT void debug_free_mixed_svalues(struct svalue *s, size_t num, INT32 type_hint DMALLOC_LINE_ARGS)
+PMOD_EXPORT void debug_free_mixed_svalues(struct svalue *s, size_t num, INT32 UNUSED(type_hint) DMALLOC_LINE_ARGS)
 {
   while(num--)
   {
diff --git a/src/threads.c b/src/threads.c
index e9172d0429..4d499251dc 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -910,7 +910,7 @@ void low_init_threads_disable(void)
  *! gc. (This advice applies to mutex locks in general, for that
  *! matter.)
  */
-void init_threads_disable(struct object *o)
+void init_threads_disable(struct object *UNUSED(o))
 {
   low_init_threads_disable();
 
@@ -928,7 +928,7 @@ void init_threads_disable(struct object *o)
   }
 }
 
-void exit_threads_disable(struct object *o)
+void exit_threads_disable(struct object *UNUSED(o))
 {
   THREADS_FPRINTF(0, (stderr, "exit_threads_disable(): threads_disabled:%d\n",
 		      threads_disabled));
@@ -1291,7 +1291,7 @@ PMOD_EXPORT int count_pike_threads(void)
   return num_pike_threads;
 }
 
-static void check_threads(struct callback *cb, void *arg, void * arg2)
+static void check_threads(struct callback *UNUSED(cb), void *UNUSED(arg), void *UNUSED(arg2))
 {
 #ifdef PROFILE_CHECK_THREADS
   static unsigned long calls = 0, yields = 0;
@@ -2258,14 +2258,14 @@ PMOD_EXPORT void f_mutex_locking_key(INT32 args)
     push_int(0);
 }
 
-void init_mutex_obj(struct object *o)
+void init_mutex_obj(struct object *UNUSED(o))
 {
   co_init(& THIS_MUTEX->condition);
   THIS_MUTEX->key=0;
   THIS_MUTEX->num_waiting = 0;
 }
 
-void exit_mutex_obj(struct object *o)
+void exit_mutex_obj(struct object *UNUSED(o))
 {
   struct mutex_storage *m = THIS_MUTEX;
   struct object *key = m->key;
@@ -2303,7 +2303,7 @@ void exit_mutex_obj(struct object *o)
 #endif
 }
 
-void exit_mutex_obj_compat_7_4(struct object *o)
+void exit_mutex_obj_compat_7_4(struct object *UNUSED(o))
 {
   struct mutex_storage *m = THIS_MUTEX;
   struct object *key = m->key;
@@ -2341,7 +2341,7 @@ void exit_mutex_obj_compat_7_4(struct object *o)
  *!   @[Mutex], @[Condition]
  */
 #define THIS_KEY ((struct key_storage *)(CURRENT_STORAGE))
-void init_mutex_key_obj(struct object *o)
+void init_mutex_key_obj(struct object *UNUSED(o))
 {
   THREADS_FPRINTF(1, (stderr, "KEY k:%p, t:%p\n",
 		      THIS_KEY, Pike_interpreter.thread_state));
@@ -2352,7 +2352,7 @@ void init_mutex_key_obj(struct object *o)
   THIS_KEY->initialized=1;
 }
 
-void exit_mutex_key_obj(struct object *o)
+void exit_mutex_key_obj(struct object *DEBUGUSED(o))
 {
   THREADS_FPRINTF(1, (stderr, "UNLOCK k:%p m:(%p) t:%p o:%p\n",
 		      THIS_KEY, THIS_KEY->mut,
@@ -2574,13 +2574,13 @@ void f_cond_broadcast(INT32 args)
   co_broadcast(&(THIS_COND->cond));
 }
 
-void init_cond_obj(struct object *o)
+void init_cond_obj(struct object *UNUSED(o))
 {
   co_init(&(THIS_COND->cond));
   THIS_COND->wait_count = 0;
 }
 
-void exit_cond_obj(struct object *o)
+void exit_cond_obj(struct object *UNUSED(o))
 {
   /* Wake up any threads that might be waiting on this cond.
    *
@@ -2698,7 +2698,7 @@ void f_thread_id_id_number(INT32 args)
  *! Waits for the thread to complete, and then returns
  *! the value returned from the thread function.
  */
-static void f_thread_id_result(INT32 args)
+static void f_thread_id_result(INT32 UNUSED(args))
 {
   struct thread_state *th=THIS_THREAD;
 
@@ -2735,7 +2735,7 @@ static int num_pending_interrupts = 0;
 static struct callback *thread_interrupt_callback = NULL;
 
 static void check_thread_interrupt(struct callback *foo,
-				   void *bar, void *gazonk)
+				   void *UNUSED(bar), void *UNUSED(gazonk))
 {
   if (Pike_interpreter.thread_state->flags & THREAD_FLAG_SIGNAL_MASK) {
     if (Pike_interpreter.thread_state->flags & THREAD_FLAG_TERM) {
@@ -2813,7 +2813,7 @@ static void f_thread_id_kill(INT32 args)
   push_int(0);
 }
 
-void init_thread_obj(struct object *o)
+void init_thread_obj(struct object *UNUSED(o))
 {
   MEMSET(&THIS_THREAD->state, 0, sizeof(struct Pike_interpreter_struct));
   THIS_THREAD->thread_obj = Pike_fp->current_object;
@@ -2852,7 +2852,7 @@ static void cleanup_thread_state (struct thread_state *th)
   th_destroy(& THIS_THREAD->id);
 }
 
-void exit_thread_obj(struct object *o)
+void exit_thread_obj(struct object *UNUSED(o))
 {
   THIS_THREAD->thread_obj = NULL;
 
@@ -2867,14 +2867,14 @@ void exit_thread_obj(struct object *o)
 /*! @endclass
  */
 
-static void thread_was_recursed(struct object *o)
+static void thread_was_recursed(struct object *UNUSED(o))
 {
   struct thread_state *tmp=THIS_THREAD;
   if(tmp->thread_local != NULL)
     gc_recurse_mapping(tmp->thread_local);
 }
 
-static void thread_was_checked(struct object *o)
+static void thread_was_checked(struct object *UNUSED(o))
 {
   struct thread_state *tmp=THIS_THREAD;
   if(tmp->thread_local != NULL)
-- 
GitLab