Skip to content

Commit

Permalink
mark clientData as UNUSED everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jerily committed Aug 28, 2024
1 parent 9fb3e49 commit d1c3205
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ typedef int Tcl_Size;
#define XSTR(s) STR(s)
#define STR(s) #s

#define UNUSED(expr) do { (void)(expr); } while (0)

#ifdef DEBUG
# define DBG(x) x
#ifndef __FUNCTION_NAME__
#ifdef _WIN32 // WINDOWS
#define __FUNCTION_NAME__ __FUNCTION__
#else // GCC
#define __FUNCTION_NAME__ __func__
#endif
#endif
# define DBG2(x) {printf("%s: ", __FUNCTION_NAME__); x; printf("\n"); fflush(stdout);}
#else
# define DBG(x)
# define DBG2(x)
#endif

#define ObjCmdProc(x) int (x)(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
Expand Down
10 changes: 9 additions & 1 deletion src/compiler_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int thtml_CCompileQuotedString(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_
const char *name);

int thtml_CCompileCommand(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_DString *ds_ptr, Tcl_Parse *parse_ptr,
const char *name, int nested, int *compiled_cmd);
const char *name, int nested, int *compiled_command);

void thtml_CGarbageCollection(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_DString *ds_ptr) {

Expand Down Expand Up @@ -210,6 +210,8 @@ void thtml_CListRemoveGC(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, const char
}

int thtml_CTransformCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);

DBG(fprintf(stderr, "TclTransformCmd\n"));

CheckArgs(2, 2, 1, "intermediate_code");
Expand Down Expand Up @@ -280,6 +282,7 @@ int thtml_CTransformCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl
}

int thtml_CCompileExprCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileExprCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down Expand Up @@ -312,6 +315,7 @@ int thtml_CCompileExprCmd(ClientData clientData, Tcl_Interp *interp, int objc, T
}

int thtml_CCompileQuotedStringCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileQuotedStringCmd\n"));

CheckArgs(3, 3, 1, "codearrVar text");
Expand Down Expand Up @@ -341,6 +345,7 @@ int thtml_CCompileQuotedStringCmd(ClientData clientData, Tcl_Interp *interp, int
}

int thtml_CCompileTemplateTextCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileTemplateTextCmd\n"));

CheckArgs(3, 3, 1, "codearrVar text");
Expand Down Expand Up @@ -406,6 +411,7 @@ int thtml_CCompileTemplateTextCmd(ClientData clientData, Tcl_Interp *interp, int
}

int thtml_CCompileScriptCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileScriptCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down Expand Up @@ -2308,6 +2314,7 @@ thtml_CCompileForeachList(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_DStri
}

int thtml_CCompileForeachListCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileForeachListCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down Expand Up @@ -2394,6 +2401,7 @@ thtml_CCompileQuotedArg(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_DString
}

int thtml_CCompileQuotedArgCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "CCompileQuotedArgCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down
6 changes: 6 additions & 0 deletions src/compiler_tcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static int thtml_TclAppendCommand_Token(Tcl_Interp *interp, Tcl_Obj *codearrVar_
Tcl_Size i, Tcl_Size *out_i, const char *name, Tcl_DString *cmd_ds_ptr, int in_eval_p);

int thtml_TclTransformCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclTransformCmd\n"));

CheckArgs(2,2,1,"intermediate_code");
Expand Down Expand Up @@ -88,6 +89,7 @@ int thtml_TclTransformCmd(ClientData clientData, Tcl_Interp *interp, int objc,
}

int thtml_TclCompileExprCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclCompileExprCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down Expand Up @@ -141,6 +143,7 @@ int thtml_TclCompileExprCmd(ClientData clientData, Tcl_Interp *interp, int objc
}

int thtml_TclCompileQuotedStringCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclCompileQuotedStringCmd\n"));

CheckArgs(3, 4, 1, "codearrVar text ?name?");
Expand Down Expand Up @@ -175,6 +178,7 @@ int thtml_TclCompileQuotedStringCmd(ClientData clientData, Tcl_Interp *interp,
}

int thtml_TclCompileTemplateTextCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclCompileTemplateTextCmd\n"));

CheckArgs(3, 3, 1, "codearrVar text");
Expand Down Expand Up @@ -239,6 +243,7 @@ int thtml_TclCompileTemplateTextCmd(ClientData clientData, Tcl_Interp *interp,
}

int thtml_TclCompileScriptCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclCompileScriptCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down Expand Up @@ -1135,6 +1140,7 @@ thtml_TclCompileForeachList(Tcl_Interp *interp, Tcl_Obj *codearrVar_ptr, Tcl_DSt
}

int thtml_TclCompileForeachListCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr, "TclCompileForeachListCmd\n"));

CheckArgs(4, 4, 1, "codearrVar text name");
Expand Down
2 changes: 2 additions & 0 deletions src/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
static int thtml_ModuleInitialized;

static int thtml_Md5Cmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr,"Md5Cmd\n"));

CheckArgs(2,2,1,"text");
Expand Down Expand Up @@ -46,6 +47,7 @@ void thtml_InitModule() {
}

int thtml_EscapeTemplateCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) {
UNUSED(clientData);
DBG(fprintf(stderr,"TclTransformCmd\n"));

CheckArgs(2,2,1,"html");
Expand Down

0 comments on commit d1c3205

Please sign in to comment.