Patch #1077 2006-05-24 21:21
danielcj
Simple fix for a compile error on GCC >= 4.0- Download
- 1077-Simple_fix_for.patch (594 bytes)
--- src/sdk/scriptingcall.h 2006-05-24 12:53:22.424842528 -0700
+++ src/sdk/scriptingcall.h 2006-05-24 12:58:17.075048888 -0700
@@ -30,7 +30,7 @@
template <typename OP> inline void ExecuteSetArg(asIScriptContext* ctx, int arg, OP op)
{
// default template treats it as 'void*'
- ctx->SetArgObject(arg, op);
+ ctx->SetArgObject(arg, (void*)op);
}
template <> inline void ExecuteSetArg(asIScriptContext* ctx, int arg, DummyOperand op){ /* do nothing */ }
template <> inline void ExecuteSetArg(asIScriptContext* ctx, int arg, asQWORD op){ ctx->SetArgQWord(arg, op); }
History
The error is from an unsigned int implicity being cast to a void*. It is spawned from line 497 in gdb_commands.h.
The error is as follows:
----------------------------------------
../../../src/sdk/scriptingcall.h: In function 'void ExecuteSetArg(asIScriptContext*, int, OP) [with OP = unsigned int]':
../../../src/sdk/scriptingcall.h:205: instantiated from 'void VoidExecutor<OP1, OP2, OP3, OP4, OP5, OP6, OP7, OP8, OP9, OP10>::SetArguments(OP1, OP2, OP3, OP4, OP5, OP6, OP7, OP8, OP9, OP10) [with OP1 = const wxString&, OP2 = const wxString&, OP3 = unsigned int, OP4 = unsigned int, OP5 = wxString&, OP6 = DummyOperand, OP7 = DummyOperand, OP8 = DummyOperand, OP9 = DummyOperand, OP10 = DummyOperand]'
../../../src/sdk/scriptingcall.h:227: instantiated from 'void VoidExecutor<OP1, OP2, OP3, OP4, OP5, OP6, OP7, OP8, OP9, OP10>::Call(OP1, OP2, OP3, OP4, OP5, OP6, OP7, OP8, OP9, OP10) [with OP1 = const wxString&, OP2 = const wxString&, OP3 = unsigned int, OP4 = unsigned int, OP5 = wxString&, OP6 = DummyOperand, OP7 = DummyOperand, OP8 = DummyOperand, OP9 = DummyOperand, OP10 = DummyOperand]'
gdb_commands.h:497: instantiated from here
../../../src/sdk/scriptingcall.h:33: error: invalid conversion from 'unsigned int' to 'void*'
../../../src/sdk/scriptingcall.h:33: error: initializing argument 2 of 'virtual int asIScriptContext::SetArgObject(asUINT, void*)'
----------------------------------------
The patch just adds an explicity cast, but I'm not sure wheter this is the right thing to do.
Is the unsigned int supposed to be forced into the void*, and its just semantics, or is this something more serious?
will apply it tomorrow : but I will use reinterpret _cast ;-)