Blame docs/macros.txt

Packit ae235b
Packit ae235b
Packit ae235b
GLib's configure options and corresponding macros
Packit ae235b
=================================================
Packit ae235b
Packit ae235b
--enable-debug=no
Packit ae235b
	-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS
Packit ae235b
--enable-debug=minimum	[default for stable branches]
Packit ae235b
	none
Packit ae235b
--enable-debug=yes	[default for development branches]
Packit ae235b
	-DG_ENABLE_DEBUG -g
Packit ae235b
--enable-gc-friendly=yes
Packit ae235b
	#define ENABLE_GC_FRIENDLY_DEFAULT 1
Packit ae235b
--disable-mem-pools=yes
Packit ae235b
	#define DISABLE_MEM_POOLS 1
Packit ae235b
Packit ae235b
Besides these, there are some local feature specific options, but my main
Packit ae235b
focus here is to concentrate on macros that affect overall GLib behaviour
Packit ae235b
and/or third party code.
Packit ae235b
Packit ae235b
Packit ae235b
Notes on GLib's internal and global macros
Packit ae235b
==========================================
Packit ae235b
Packit ae235b
Packit ae235b
ENABLE_GC_FRIENDLY_DEFAULT
Packit ae235b
	Newly allocated memory that isn't directly initialized, as well
Packit ae235b
	as memory being freed should be reset to 0. The point here is to
Packit ae235b
	allow memory checkers and similar programs that use bohem GC alike
Packit ae235b
	algorithms to produce more accurate results.
Packit ae235b
	This can also be accomplished by setting the environment variable
Packit ae235b
	G_DEBUG=gc-friendly.
Packit ae235b
DISABLE_MEM_POOLS
Packit ae235b
	Many small chunks of memory are often allocated via collective pools
Packit ae235b
	in GLib and are cached after release to speed up reallocations.
Packit ae235b
	For sparse memory systems this behaviour is often inferior, so
Packit ae235b
	memory pools can be disabled to avoid excessive caching and force
Packit ae235b
	atomic maintenance of chunks through the g_malloc/g_free.
Packit ae235b
	Code currently affected by this macro:
Packit ae235b
	- GList, GSList, GNode allocations
Packit ae235b
	- GMemChunks become basically non-effective
Packit ae235b
	- GSignal disables all caching (potentially very slow)
Packit ae235b
	- GType doesn't honour the GTypeInfo n_preallocs field anymore
Packit ae235b
	- the GBSearchArray flag G_BSEARCH_ALIGN_POWER2 becomes non-functional
Packit ae235b
G_DISABLE_ASSERT
Packit ae235b
	The g_assert() and g_assert_not_reached() become non-functional
Packit ae235b
	with this define. The motivation is to speed up end-user apps by
Packit ae235b
	avoiding expensive checks.
Packit ae235b
	This macro can affect third-party code. --enable-debug=no will only
Packit ae235b
	disable the assertion macros for GLib itself, but third-party code
Packit ae235b
	that passes -DG_DISABLE_ASSERT to the compiler upon its own build
Packit ae235b
	will end up with the non-functional variants after including glib.h
Packit ae235b
	as well.
Packit ae235b
	NOTE: Code inside the assertion macros should not have side effects
Packit ae235b
	that affect the operation of the program.
Packit ae235b
G_DISABLE_CHECKS
Packit ae235b
	This macro is similar to G_DISABLE_ASSERT, it affects third-party
Packit ae235b
	code as mentioned above and the NOTE about G_DISABLE_ASSERT applies
Packit ae235b
	too. The macros that become non-functional here are
Packit ae235b
	g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and
Packit ae235b
	g_return_val_if_reached().
Packit ae235b
	Additionally the glib_mem_profiler_table and g_mem_profile() from
Packit ae235b
	gmem.h become non-functional if this macro is supplied.
Packit ae235b
	This macro also switches off certain checks in the GSignal code.
Packit ae235b
G_ENABLE_DEBUG
Packit ae235b
	Quite a bit of additional debugging code is compiled into GLib for this
Packit ae235b
	macro, and since it is a globally visible define, third-party code may
Packit ae235b
	be affected by it similar to G_DISABLE_ASSERT.
Packit ae235b
	The additional code executed/compiled for this macro currently involve:
Packit ae235b
	- extra validity checks for GDate
Packit ae235b
	- memory profiling traps in gmem.c (consult debugging.txt for details)
Packit ae235b
	- BREAKPOINT abortion for fatal log levels in gmessage.c instead of
Packit ae235b
	  plain abort() to allow debuggers trapping and overriding them
Packit ae235b
	- added verbosity of gscanner.c to catch deprecated code paths
Packit ae235b
	- added verbosity of gutils.c to catch deprecated code paths
Packit ae235b
	- object ref/unref traps (consult debugging.txt) and object bookkeeping
Packit ae235b
	  in gobject.c
Packit ae235b
	- extra validity checks in gsignal.c
Packit ae235b
Packit ae235b
Packit ae235b
2000/12/28	Tim Janik