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