From cc5cd3d238b281fb258148f82e3ca55466beb95d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 10 Apr 2022 12:08:18 +0200 Subject: [PATCH] Adds maybe_unused to several addon scripts --- add_on/datetime/datetime.cpp | 2 +- add_on/scriptany/scriptany.cpp | 4 ++-- add_on/scriptdictionary/scriptdictionary.cpp | 4 ++-- add_on/scriptfile/scriptfile.cpp | 4 ++-- add_on/scriptgrid/scriptgrid.cpp | 2 +- add_on/scripthandle/scripthandle.cpp | 4 ++-- add_on/scripthelper/scripthelper.cpp | 2 +- add_on/scriptmath/scriptmath.cpp | 4 ++-- add_on/weakref/weakref.cpp | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/add_on/datetime/datetime.cpp b/add_on/datetime/datetime.cpp index cd56cf6..e659c1a 100644 --- a/add_on/datetime/datetime.cpp +++ b/add_on/datetime/datetime.cpp @@ -234,7 +234,7 @@ static void ConstructSet_Generic(asIScriptGeneric *gen) void RegisterScriptDateTime(asIScriptEngine *engine) { - int r = engine->RegisterObjectType("datetime", sizeof(CDateTime), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits()); assert(r >= 0); + [[maybe_unused]] int r = engine->RegisterObjectType("datetime", sizeof(CDateTime), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits()); assert(r >= 0); if(strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY")==0) { diff --git a/add_on/scriptany/scriptany.cpp b/add_on/scriptany/scriptany.cpp index a7cf312..855f58a 100644 --- a/add_on/scriptany/scriptany.cpp +++ b/add_on/scriptany/scriptany.cpp @@ -141,7 +141,7 @@ void RegisterScriptAny(asIScriptEngine *engine) void RegisterScriptAny_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; r = engine->RegisterObjectType("any", sizeof(CScriptAny), asOBJ_REF | asOBJ_GC); assert( r >= 0 ); // We'll use the generic interface for the constructor as we need the engine pointer @@ -170,7 +170,7 @@ void RegisterScriptAny_Native(asIScriptEngine *engine) void RegisterScriptAny_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; r = engine->RegisterObjectType("any", sizeof(CScriptAny), asOBJ_REF | asOBJ_GC); assert( r >= 0 ); // We'll use the generic interface for the constructor as we need the engine pointer diff --git a/add_on/scriptdictionary/scriptdictionary.cpp b/add_on/scriptdictionary/scriptdictionary.cpp index 2ae5305..c5eee3d 100644 --- a/add_on/scriptdictionary/scriptdictionary.cpp +++ b/add_on/scriptdictionary/scriptdictionary.cpp @@ -1068,7 +1068,7 @@ void RegisterScriptDictionary(asIScriptEngine *engine) void RegisterScriptDictionary_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // The array type must be available assert( engine->GetTypeInfoByDecl("array") ); @@ -1147,7 +1147,7 @@ void RegisterScriptDictionary_Native(asIScriptEngine *engine) void RegisterScriptDictionary_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // Register the cleanup callback for the object type cache engine->SetEngineUserDataCleanupCallback(SDictionaryCache::Cleanup, DICTIONARY_CACHE); diff --git a/add_on/scriptfile/scriptfile.cpp b/add_on/scriptfile/scriptfile.cpp index 5c4e26c..c8176c9 100644 --- a/add_on/scriptfile/scriptfile.cpp +++ b/add_on/scriptfile/scriptfile.cpp @@ -168,7 +168,7 @@ void ScriptFile_MovePos_Generic(asIScriptGeneric *gen) void RegisterScriptFile_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; r = engine->RegisterObjectType("file", 0, asOBJ_REF); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("file", asBEHAVE_FACTORY, "file @f()", asFUNCTION(ScriptFile_Factory), asCALL_CDECL); assert( r >= 0 ); @@ -201,7 +201,7 @@ void RegisterScriptFile_Native(asIScriptEngine *engine) void RegisterScriptFile_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; r = engine->RegisterObjectType("file", 0, asOBJ_REF); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("file", asBEHAVE_FACTORY, "file @f()", asFUNCTION(ScriptFile_Factory_Generic), asCALL_GENERIC); assert( r >= 0 ); diff --git a/add_on/scriptgrid/scriptgrid.cpp b/add_on/scriptgrid/scriptgrid.cpp index f636267..dbe97bf 100644 --- a/add_on/scriptgrid/scriptgrid.cpp +++ b/add_on/scriptgrid/scriptgrid.cpp @@ -220,7 +220,7 @@ void RegisterScriptGrid(asIScriptEngine *engine) static void RegisterScriptGrid_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // Register the grid type as a template r = engine->RegisterObjectType("grid", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 ); diff --git a/add_on/scripthandle/scripthandle.cpp b/add_on/scripthandle/scripthandle.cpp index 1114b2b..0792c2c 100644 --- a/add_on/scripthandle/scripthandle.cpp +++ b/add_on/scripthandle/scripthandle.cpp @@ -230,7 +230,7 @@ void CScriptHandle::ReleaseReferences(asIScriptEngine * /*inEngine*/) void RegisterScriptHandle_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; #if AS_CAN_USE_CPP11 // With C++11 it is possible to use asGetTypeTraits to automatically determine the flags that represent the C++ class @@ -332,7 +332,7 @@ void CScriptHandle_ReleaseReferences_Generic(asIScriptGeneric *gen) void RegisterScriptHandle_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r = 0; r = engine->RegisterObjectType("ref", sizeof(CScriptHandle), asOBJ_VALUE | asOBJ_ASHANDLE | asOBJ_GC | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("ref", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(CScriptHandle_Construct_Generic), asCALL_GENERIC); assert( r >= 0 ); diff --git a/add_on/scripthelper/scripthelper.cpp b/add_on/scripthelper/scripthelper.cpp index d3c4e1c..ff9e060 100644 --- a/add_on/scripthelper/scripthelper.cpp +++ b/add_on/scripthelper/scripthelper.cpp @@ -976,7 +976,7 @@ string ScriptGetExceptionInfo() void RegisterExceptionRoutines(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // The string type must be available assert(engine->GetTypeInfoByDecl("string")); diff --git a/add_on/scriptmath/scriptmath.cpp b/add_on/scriptmath/scriptmath.cpp index c5b86c3..5144dcb 100644 --- a/add_on/scriptmath/scriptmath.cpp +++ b/add_on/scriptmath/scriptmath.cpp @@ -132,7 +132,7 @@ bool closeTo(double a, double b, double epsilon) void RegisterScriptMath_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // Conversion between floating point and IEEE bits representations r = engine->RegisterGlobalFunction("float fpFromIEEE(uint)", asFUNCTIONPR(fpFromIEEE, (asUINT), float), asCALL_CDECL); assert( r >= 0 ); @@ -278,7 +278,7 @@ void atan2_generic(asIScriptGeneric *gen) #endif void RegisterScriptMath_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; #if AS_USE_FLOAT // Trigonometric functions diff --git a/add_on/weakref/weakref.cpp b/add_on/weakref/weakref.cpp index 7d82a15..97dd8bf 100644 --- a/add_on/weakref/weakref.cpp +++ b/add_on/weakref/weakref.cpp @@ -220,7 +220,7 @@ bool CScriptWeakRef::Equals(void *ref) const void RegisterScriptWeakRef_Native(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // Register a type for non-const handles r = engine->RegisterObjectType("weakref", sizeof(CScriptWeakRef), asOBJ_VALUE | asOBJ_ASHANDLE | asOBJ_TEMPLATE | asOBJ_APP_CLASS_DAK); assert( r >= 0 ); @@ -326,7 +326,7 @@ static void ScriptWeakRefTemplateCallback_Generic(asIScriptGeneric *gen) void RegisterScriptWeakRef_Generic(asIScriptEngine *engine) { - int r; + [[maybe_unused]] int r; // Register a type for non-const handles r = engine->RegisterObjectType("weakref", sizeof(CScriptWeakRef), asOBJ_VALUE | asOBJ_ASHANDLE | asOBJ_TEMPLATE | asOBJ_APP_CLASS_DAK); assert( r >= 0 );