From 729743dd31889bb0d9cf57cd006a5630bd33447e Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Thu, 7 Mar 2024 11:34:41 -0600 Subject: [PATCH] Fix remaining unused variable warnings and enable constructor argument reordered warnings, as they are also easy to fix and quite numerous. Continues work on #347. --- Core/ClientSMLSWIG/Tcl/Tcl_sml_ClientInterface.i | 6 +----- SConstruct | 2 +- SoarCLI/soar_cli.h | 2 +- UnitTests/SoarUnitTests/FullTests.cpp | 1 + UnitTests/TestExternalLibraryLib.cpp | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Core/ClientSMLSWIG/Tcl/Tcl_sml_ClientInterface.i b/Core/ClientSMLSWIG/Tcl/Tcl_sml_ClientInterface.i index 619300bea3..3dfc2dfeff 100644 --- a/Core/ClientSMLSWIG/Tcl/Tcl_sml_ClientInterface.i +++ b/Core/ClientSMLSWIG/Tcl/Tcl_sml_ClientInterface.i @@ -68,7 +68,6 @@ static int ThreadEventProc(Tcl_Event *evPtr, int mask) { ThreadEvent *threadEventPtr = (ThreadEvent *)evPtr; - ThreadEventResult *resultPtr = threadEventPtr->resultPtr; Tcl_Interp *interp = dispinterp; int code; char const* result; @@ -77,8 +76,6 @@ // Check which thread we're on. // I hope this is the thread I asked to be part of. - Tcl_ThreadId currentThread = Tcl_GetCurrentThread() ; - if (interp == NULL) { code = TCL_ERROR; result = "no target interp!"; @@ -110,7 +107,6 @@ int tcl_thread_send(Tcl_Interp* interp, Tcl_ThreadId id, Tcl_Obj* script) { ThreadEvent *threadEventPtr; - ThreadEventResult *resultPtr; Tcl_ThreadId threadId = (Tcl_ThreadId) id; // Cache the interpreter so we can find it again later @@ -122,7 +118,7 @@ threadEventPtr = (ThreadEvent *) ckalloc(sizeof(ThreadEvent)); threadEventPtr->script = script; - resultPtr = threadEventPtr->resultPtr = NULL; + threadEventPtr->resultPtr = NULL; /* * Queue the event and poke the other thread's notifier. diff --git a/SConstruct b/SConstruct index 66729ae01a..b728e589a8 100644 --- a/SConstruct +++ b/SConstruct @@ -232,7 +232,7 @@ else: # cflags.extend(['-Werror']) # We're starting with something simple. We'll add more as we go. - cflags.append('-Wunused-variable') + cflags.extend(['-Wunused-variable', '-Wreorder-ctor']) # warning doesn't exist in Apple's clang if sys.platform != 'darwin': diff --git a/SoarCLI/soar_cli.h b/SoarCLI/soar_cli.h index 1d9c5fdbb4..2816a36d5d 100644 --- a/SoarCLI/soar_cli.h +++ b/SoarCLI/soar_cli.h @@ -103,7 +103,7 @@ class InputThread : public soar_thread::Thread } bool readcmd(std::string& result) { - int nestlvl, i, n; + int nestlvl, n; std::string line; std::stringstream cmd; diff --git a/UnitTests/SoarUnitTests/FullTests.cpp b/UnitTests/SoarUnitTests/FullTests.cpp index 9ec3a8d581..745b113c1c 100644 --- a/UnitTests/SoarUnitTests/FullTests.cpp +++ b/UnitTests/SoarUnitTests/FullTests.cpp @@ -449,6 +449,7 @@ void FullTests_Parent::testRHSHandler() no_agent_assertTrue(cppRhsHandlerReceived); no_agent_assertTrue(m_pKernel->RemoveRhsFunction(callback_rhs1)); + no_agent_assertTrue(m_pKernel->RemoveRhsFunction(callback_rhs_cpp)); // Re-add it without the bool that is getting popped off the stack no_agent_assertTrue(m_pKernel->AddRhsFunction("test-rhs", Handlers::MyRhsFunctionHandler, 0)); diff --git a/UnitTests/TestExternalLibraryLib.cpp b/UnitTests/TestExternalLibraryLib.cpp index a07bc4faab..10729133e1 100644 --- a/UnitTests/TestExternalLibraryLib.cpp +++ b/UnitTests/TestExternalLibraryLib.cpp @@ -21,7 +21,7 @@ extern "C" // Soar calls this when the library is loaded RHS_EXPORT const char *sml_InitLibrary(Kernel *pKernel, int argc, char **argv) { - int callbackId = pKernel->AddRhsFunction("test", [](smlRhsEventId id, Agent *pAgent, char const *pFunctionName, char const *pArgument) + pKernel->AddRhsFunction("test", [](smlRhsEventId id, Agent *pAgent, char const *pFunctionName, char const *pArgument) { return "myLibTest"; }); return ""; }