From: terencehill Date: Tue, 26 May 2020 21:56:16 +0000 (+0200) Subject: Simplify REGISTER_REGISTRY macro X-Git-Tag: xonotic-v0.8.5~1010^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eb5aac3757e45db2f8b8a685691b51228c03f7a2;p=xonotic%2Fxonotic-data.pk3dir.git Simplify REGISTER_REGISTRY macro --- diff --git a/qcsrc/lib/registry.qh b/qcsrc/lib/registry.qh index b25878c34..2db3ae34f 100644 --- a/qcsrc/lib/registry.qh +++ b/qcsrc/lib/registry.qh @@ -191,10 +191,7 @@ void Registry_send(string id, string hash); } \ void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } \ -#define REGISTER_REGISTRY(...) EVAL_REGISTER_REGISTRY(OVERLOAD(REGISTER_REGISTRY, __VA_ARGS__)) -#define EVAL_REGISTER_REGISTRY(...) __VA_ARGS__ -#define REGISTER_REGISTRY_1(id) REGISTER_REGISTRY_2(id, #id) -#define REGISTER_REGISTRY_2(id, str) \ +#define _REGISTER_REGISTRY(id, str) \ ACCUMULATE_FUNCTION(__static_init_1, Register##id) \ CLASS(id##Registry, Object) \ ATTRIB(id##Registry, m_name, string, str); \ @@ -206,3 +203,5 @@ void Registry_send(string id, string hash); id##_state = 0; \ Register##id(); \ } + +#define REGISTER_REGISTRY(id) _REGISTER_REGISTRY(id, #id)