]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
If debug isn't enabled (-DNDEBUG=1) don't create 2 unused functions for each CLASS
authorterencehill <piuntn@gmail.com>
Sun, 18 Jun 2017 23:08:32 +0000 (01:08 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 18 Jun 2017 23:08:32 +0000 (01:08 +0200)
qcsrc/lib/oo.qh

index 7a7a72641a0601a1d857a0654631223d452275dd..f57bf8e909c4e7d1a594a0e36f2415b715483fda 100644 (file)
@@ -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)                     \
        {                                       \