diff options
| author | dgp <dgp@users.sourceforge.net> | 2020-03-02 17:08:01 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2020-03-02 17:08:01 (GMT) |
| commit | 71e8c4c72b18b1f2e78b53f4ca5d67a029de99d0 (patch) | |
| tree | 0eb1f9327bbe073cd951e018bacc782b01150518 | |
| parent | ac5f46d2701330d40d72814660be2efa4b69e39f (diff) | |
| download | tcl-71e8c4c72b18b1f2e78b53f4ca5d67a029de99d0.zip tcl-71e8c4c72b18b1f2e78b53f4ca5d67a029de99d0.tar.gz tcl-71e8c4c72b18b1f2e78b53f4ca5d67a029de99d0.tar.bz2 | |
Create a new macro to deal with unused arguments so we can silence compiler
warnings without the need of an explosion of noise lines "(void)dummy"
| -rw-r--r-- | generic/tcl.h | 10 | ||||
| -rw-r--r-- | generic/tclZlib.c | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 369a894..4e601ca 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -146,6 +146,11 @@ extern "C" { # else # define TCL_NORETURN1 /* nothing */ # endif +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) +# endif #else # define TCL_FORMAT_PRINTF(a,b) # if defined(_MSC_VER) && (_MSC_VER >= 1310) @@ -156,6 +161,11 @@ extern "C" { # define TCL_NOINLINE /* nothing */ # endif # define TCL_NORETURN1 /* nothing */ +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) +# endif #endif /* diff --git a/generic/tclZlib.c b/generic/tclZlib.c index ac69511..1ab20fe 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1920,7 +1920,7 @@ Tcl_ZlibAdler32( static int ZlibCmd( - void *dummy, + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1939,7 +1939,6 @@ ZlibCmd( CMD_ADLER, CMD_COMPRESS, CMD_CRC, CMD_DECOMPRESS, CMD_DEFLATE, CMD_GUNZIP, CMD_GZIP, CMD_INFLATE, CMD_PUSH, CMD_STREAM }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command arg ?...?"); |
