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.
This commit is contained in:
Thomas Haller 2016-07-05 18:26:24 +02:00
parent 39e7c9e8fd
commit 42940fd66b

View file

@ -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, "<unknown-fcn>", (expr) ? "<dropped>" : 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__, \
"<dropped>"); \
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__, \
"<dropped>"); \
return; \
} G_STMT_END
#define NM_ASSERT_G_RETURN_EXPR(expr) "<dropped>"
#define NM_ASSERT_NO_MSG 1