From b386a09358d7e3b9184e72ead3678a94f72d20ed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 5 Jan 2019 20:48:22 +0100 Subject: [PATCH] - changed AFuncDesc initialization to avoid generating initializer functions. Visual C++ will never statically initialize a class instance where a member field has a default value set, so the DEFINE_ACTION_FUNCTION variants without a direct native call need to be handled differently. The easiest way to do this is to leave out the nullptr default and omit the value in the initializer list. For trailing fields this will always get them nulled. --- src/scripting/vm/vm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index f65440f6f..8cd666467 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -601,7 +601,7 @@ struct DirectNativeDesc operator void *() const { return Ptr; } - void *Ptr = nullptr; + void *Ptr; }; struct AFuncDesc @@ -642,7 +642,7 @@ struct AFuncDesc #define DEFINE_ACTION_FUNCTION_NATIVE0(cls, name, native) \ static int AF_##cls##_##name(VM_ARGS); \ VMNativeFunction *cls##_##name##_VMPtr; \ - static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr, {} }; \ + static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr }; \ extern AFuncDesc const *const cls##_##name##_HookPtr; \ MSVC_ASEG AFuncDesc const *const cls##_##name##_HookPtr GCC_ASEG = &cls##_##name##_Hook; \ static int AF_##cls##_##name(VM_ARGS) @@ -650,7 +650,7 @@ struct AFuncDesc #define DEFINE_ACTION_FUNCTION(cls, name) \ static int AF_##cls##_##name(VM_ARGS); \ VMNativeFunction *cls##_##name##_VMPtr; \ - static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr, {} }; \ + static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr }; \ extern AFuncDesc const *const cls##_##name##_HookPtr; \ MSVC_ASEG AFuncDesc const *const cls##_##name##_HookPtr GCC_ASEG = &cls##_##name##_Hook; \ static int AF_##cls##_##name(VM_ARGS)