From 7d497a3a92973d4cec14888b932091f49de1d190 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 May 2019 16:20:03 -0700 Subject: [PATCH] [debug] Allow return_trace() to return any type --- src/hb-debug.hh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hb-debug.hh b/src/hb-debug.hh index 52d5942c..00696058 100644 --- a/src/hb-debug.hh +++ b/src/hb-debug.hh @@ -330,18 +330,20 @@ struct hb_auto_trace_t<0, ret_t> const char *message, ...) HB_PRINTF_FUNC(6, 7) {} - ret_t ret (ret_t v, - const char *func HB_UNUSED = nullptr, - unsigned int line HB_UNUSED = 0) { return v; } + template + T ret (T&& v, + const char *func HB_UNUSED = nullptr, + unsigned int line HB_UNUSED = 0) { return hb_forward (v); } }; /* For disabled tracing; optimize out everything. * https://github.com/harfbuzz/harfbuzz/pull/605 */ template struct hb_no_trace_t { - ret_t ret (ret_t v, - const char *func HB_UNUSED = "", - unsigned int line HB_UNUSED = 0) { return v; } + template + T ret (T&& v, + const char *func HB_UNUSED = nullptr, + unsigned int line HB_UNUSED = 0) { return hb_forward (v); } }; #define return_trace(RET) return trace.ret (RET, HB_FUNC, __LINE__) -- GitLab