From: terencehill Date: Sun, 18 Jun 2017 23:08:32 +0000 (+0200) Subject: If debug isn't enabled (-DNDEBUG=1) don't create 2 unused functions for each CLASS X-Git-Tag: xonotic-v0.8.5~2722 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e08be9d024b6d6ed2bdcb545de99d4a466a4f143;p=xonotic%2Fxonotic-data.pk3dir.git If debug isn't enabled (-DNDEBUG=1) don't create 2 unused functions for each CLASS --- diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 7a7a72641..f57bf8e90 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -171,11 +171,19 @@ STATIC_INIT(RegisterClasses) #define _INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this) #define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this) +#if NDEBUG + #define DEBUG_STUFF(cname) +#else + #define DEBUG_STUFF(cname) \ + bool is_##cname(entity e) { return e.instanceOf##cname; } \ + void isnt_##cname(entity e) { eprint(e); } +#endif + + #define CLASS(cname, base) \ entityclass(cname, base); \ class(cname).bool instanceOf##cname; \ - bool is_##cname(entity e) { return e.instanceOf##cname; } \ - void isnt_##cname(entity e) { eprint(e); } \ + DEBUG_STUFF(cname) \ VTBL(cname, base) \ _INIT_STATIC(cname) \ { \