From cd7825d9d52aaeddf8e0c68a2616b78fbafaca23 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 20 Apr 2023 13:58:48 -0700 Subject: [PATCH] build: allow -Dtracing for more logging information --- lib/mks-util-private.h | 6 +++--- meson.build | 3 +++ meson_options.txt | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/mks-util-private.h b/lib/mks-util-private.h index 741bcc2..e5aa90c 100644 --- a/lib/mks-util-private.h +++ b/lib/mks-util-private.h @@ -33,13 +33,13 @@ G_BEGIN_DECLS CAIRO_VERSION_MICRO >= (micro))) #ifdef MKS_DEBUG -# define MKS_ENTRY G_STMT_START { g_debug("ENTRY: %s():%u", G_STRFUNC, __LINE__) } G_STMT_END +# define MKS_ENTRY G_STMT_START { g_debug("ENTRY: %s():%u", G_STRFUNC, __LINE__); } G_STMT_END # define MKS_EXIT G_STMT_START { g_debug(" EXIT: %s():%u", G_STRFUNC, __LINE__); return; } G_STMT_END -# define MKS_RETURN(_r) G_STMT_START { g_debug(" EXIT: %s():%u", G_STRFUNC, __LINE__); return (_r); } G_STMT_END +# define MKS_RETURN(_r) G_STMT_START { typeof(_r) __ret = (_r); g_debug(" EXIT: %s():%u", G_STRFUNC, __LINE__); return __ret; } G_STMT_END #else # define MKS_ENTRY G_STMT_START { } G_STMT_END # define MKS_EXIT G_STMT_START { return; } G_STMT_END -# define MKS_RETURN(_r) G_STMT_START { return (_r); } G_STMT_END +# define MKS_RETURN(_r) G_STMT_START { typeof(_r) __ret = (_r); return (__ret); } G_STMT_END #endif gboolean mks_scroll_event_is_inverted (GdkEvent *event); diff --git a/meson.build b/meson.build index 1176cbf..89802b2 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,9 @@ project_c_args = ['-DMKS_COMPILATION'] config_h = configuration_data() config_h.set_quoted('GETTEXT_PACKAGE', 'libmks-@0@'.format(api_version)) config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) +if get_option('tracing') + config_h.set10('MKS_DEBUG', true) +endif add_project_arguments(['-I' + meson.project_build_root()], language: 'c') # Check dependencies diff --git a/meson_options.txt b/meson_options.txt index ece7dad..0eacbbe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -9,3 +9,8 @@ option('introspection', description: 'Generate gir data') option('vapi', type: 'boolean', value: true) + +option('tracing', + type: 'boolean', + value: false, + description: 'Enable developer tracing information in logs')