From 42940fd66be9b412523cc4cedf9b24f0fb95e477 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 Jul 2016 18:26:24 +0200 Subject: [PATCH] shared: drop function name from g_return_val_if_reached() When using g_return_val_if_reached(), the default macro would include the function name. This name is increasing the binary size. Replace it in non-debug builds. --- shared/nm-default.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/shared/nm-default.h b/shared/nm-default.h index 547ee57c98..d8ca04bb6b 100644 --- a/shared/nm-default.h +++ b/shared/nm-default.h @@ -86,6 +86,30 @@ _nm_g_return_if_fail_warning (const char *log_domain, #define g_assertion_message_expr(domain, file, line, func, expr) \ g_assertion_message_expr(domain, file, line, "", (expr) ? "" : NULL) +#undef g_return_val_if_reached +#define g_return_val_if_reached(val) \ + G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + ""); \ + return (val); \ + } G_STMT_END + +#undef g_return_if_reached +#define g_return_if_reached() \ + G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + ""); \ + return; \ + } G_STMT_END + #define NM_ASSERT_G_RETURN_EXPR(expr) "" #define NM_ASSERT_NO_MSG 1