Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: silence compiler warning for static function.



For a build on a system where USE_MMAP is not defined, you get a
compiler warning for:

  In file included from parse.c:31:
  parse.pro:44:13: warning: 'freedump' declared 'static' but never defined [-Wunused-function]

This is because freedump() is prefixed with /**/ so is added to the
prototype. One option is to prefix also the #ifdefs but the patch below
instead drops freedump() from the prototype file.

We have many cases both of static functions being prefixed with /**/ and
not. The advantage of doing so is that you can call the function before
it is defined. Does anyone feel strongly that we should be more
consistent on this and if so, what the preferred approach would be? I
think the original intention was for them to be in the prototype files
but my own opinion would sooner be to avoid extra zsh-specific magic as
much as possible.

Oliver

diff --git a/Src/parse.c b/Src/parse.c
index 4ce5a4650..0ba7c701c 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -3962,7 +3962,6 @@ incrdumpcount(FuncDump f)
     f->count++;
 }
 
-/**/
 static void
 freedump(FuncDump f)
 {




Messages sorted by: Reverse Date, Date, Thread, Author