1GLib's configure options and corresponding macros 2================================================= 3 4--buildtype={plain,release,minsize,custom} 5 none 6--buildtype={debug,debugoptimized} [debugoptimized is the default] 7 -DG_ENABLE_DEBUG -g 8-Dglib_debug=disabled 9 Omits G_ENABLE_DEBUG when implied by --buildtype/-Ddebug 10-Dglib_debug=enabled 11 Defines G_ENABLE_DEBUG regardless of --buildtype/-Ddebug 12-Dglib_asserts=false 13 -DG_DISABLE_ASSERT 14-Dglib_checks=false 15 -DG_DISABLE_CHECKS 16 17Besides these, there are some local feature specific options, but my main 18focus here is to concentrate on macros that affect overall GLib behaviour 19and/or third party code. 20 21 22Notes on GLib's internal and global macros 23========================================== 24 25G_DISABLE_ASSERT 26 The g_assert() and g_assert_not_reached() become non-functional 27 with this define. The motivation is to speed up end-user apps by 28 avoiding expensive checks. 29 This macro can affect third-party code. Defining it when building GLib 30 will only disable the assertion macros for GLib itself, but third-party code 31 that passes -DG_DISABLE_ASSERT to the compiler upon its own build 32 will end up with the non-functional variants after including glib.h 33 as well. 34 NOTE: Code inside the assertion macros should not have side effects 35 that affect the operation of the program. 36G_DISABLE_CHECKS 37 This macro is similar to G_DISABLE_ASSERT, it affects third-party 38 code as mentioned above and the NOTE about G_DISABLE_ASSERT applies 39 too. The macros that become non-functional here are 40 g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and 41 g_return_val_if_reached(). 42 Additionally the glib_mem_profiler_table and g_mem_profile() from 43 gmem.h become non-functional if this macro is supplied. 44 This macro also switches off certain checks in the GSignal code. 45G_ENABLE_DEBUG 46 Quite a bit of additional debugging code is compiled into GLib for this 47 macro, and since it is a globally visible define, third-party code may 48 be affected by it similar to G_DISABLE_ASSERT. 49 The additional code executed/compiled for this macro currently involve: 50 - extra validity checks for GDate 51 - memory profiling traps in gmem.c (consult debugging.txt for details) 52 - BREAKPOINT abortion for fatal log levels in gmessage.c instead of 53 plain abort() to allow debuggers trapping and overriding them 54 - added verbosity of gscanner.c to catch deprecated code paths 55 - added verbosity of gutils.c to catch deprecated code paths 56 - object ref/unref traps (consult debugging.txt) and object bookkeeping 57 in gobject.c 58 - extra validity checks in gsignal.c