wren-lang / wren

The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.
http://wren.io
MIT License
6.9k stars 552 forks source link

Fix unused parameter warnings #1061

Open RobLoach opened 2 years ago

RobLoach commented 2 years ago

When compiling with -Wall -Wextra, there are a few unused-parameter warnings. See the entire list of unused parameter warnings.

While we don't really need to fix these up, it would be nice...

I propose in wren_common.h...

// Allow specifying unused parameters of a function.
#define WREN_UNUSED(x) (void)(x)

And then when there is an unused parameter, declare it.

// wren_opt_random.c
WrenForeignClassMethods wrenRandomBindForeignClass(WrenVM* vm,
                                                   const char* module,
                                                   const char* className)
{
  ASSERT(strcmp(className, "Random") == 0, "Should be in Random class.");
  WrenForeignClassMethods methods;
  methods.allocate = randomAllocate;
  methods.finalize = NULL;
  WREN_UNUSED(vm);
  return methods;
}
mhermier commented 2 years ago

To be more safe it should be:

#define WREN_UNUSED(x) ((void)(x))

Otherwise it is good for me.