1
0
Fork 0

build: Disable asserts and cast checks in Mutter

For non-debug and non-plain cases - i.e. mainly release builds.

This ensures we use the same options in all places and draws a cleaner
distinction between g_assert() and g_return_if_fail() - the later will
still be done in release build while the former are meant for debug
only.

One advantage of doing this is that it allows us to use non-trivial
asserts more generously, such as calling `g_list_length()`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3424>
This commit is contained in:
Robert Mader 2023-10-17 11:50:13 +02:00 committed by Robert Mader
parent 2666aabde2
commit 8e912a09d1
4 changed files with 5 additions and 21 deletions

View file

@ -17,11 +17,6 @@ if buildtype != 'plain'
clutter_debug_c_args += [
'-DCLUTTER_ENABLE_DEBUG',
]
else
clutter_debug_c_args += [
'-DG_DISABLE_ASSERT',
'-DG_DISABLE_CAST_CHECKS',
]
endif
endif
clutter_debug_c_args = cc.get_supported_arguments(clutter_debug_c_args)

View file

@ -86,10 +86,6 @@ if buildtype != 'plain'
cogl_debug_c_args += [
'-DCOGL_ENABLE_DEBUG',
]
else
cogl_debug_c_args += [
'-DG_DISABLE_CAST_CHECKS',
]
endif
endif
cogl_debug_c_args = cc.get_supported_arguments(cogl_debug_c_args)

View file

@ -519,6 +519,11 @@ if buildtype != 'plain'
mutter_c_args += [
'-DG_ENABLE_DEBUG',
]
else
mutter_c_args += [
'-DG_DISABLE_ASSERT',
'-DG_DISABLE_CAST_CHECKS',
]
endif
supported_mutter_c_args = cc.get_supported_arguments(mutter_c_args)

View file

@ -13,18 +13,6 @@ mtk_c_args = [
'-DG_LOG_DOMAIN="Mtk"',
]
mtk_debug_c_args = []
if buildtype != 'plain'
if not get_option('debug')
mtk_debug_c_args += [
'-DG_DISABLE_ASSERT',
'-DG_DISABLE_CAST_CHECKS',
]
endif
endif
mtk_debug_c_args = cc.get_supported_arguments(mtk_debug_c_args)
mtk_c_args += mtk_debug_c_args
mtk_pkg_deps = [
glib_dep,
gobject_dep,