From e09fc70ee25c480b1f87e6c7202a9ac7b8a48307 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 31 Aug 2015 19:25:08 +1000 Subject: [PATCH] Initialize mutators later with STATIC_INIT_LATE --- qcsrc/common/mutators/base.qh | 3 +++ qcsrc/lib/Registry.qh | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 4c39d6f7d..d92bd5b57 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -228,6 +228,9 @@ STATIC_INIT(Mutators) { RegisterHooks(); RegisterCallbacks(); RegisterMutators(); +} + +STATIC_INIT_LATE(Mutators) { FOREACH(MUTATORS, it.mutatorcheck(), LAMBDA(Mutator_Add(it))); } diff --git a/qcsrc/lib/Registry.qh b/qcsrc/lib/Registry.qh index 8a93146d5..b9e2fd653 100644 --- a/qcsrc/lib/Registry.qh +++ b/qcsrc/lib/Registry.qh @@ -25,13 +25,17 @@ ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \ REGISTER_INIT(ns, id) -void __static_init() { } +void __static_init_early() { } +void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); } #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init) -#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func) +#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func) -#define STATIC_INIT(func) \ +#define _STATIC_INIT(where, func) \ void _static_##func(); \ - ACCUMULATE_FUNCTION(__static_init, _static_##func) \ + ACCUMULATE_FUNCTION(where, _static_##func) \ void _static_##func() +#define STATIC_INIT(func) _STATIC_INIT(__static_init_early, func##_early) +#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init, func) + #endif -- 2.39.2