From ae63cf206291befe3920adfe015e6cd0961580e5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 19 Jul 2012 20:45:41 -0400 Subject: [PATCH] Print line number during return when tracing --- src/hb-private.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-private.hh b/src/hb-private.hh index 02ed9ceac..7b778b7d9 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -676,14 +676,14 @@ struct hb_auto_trace_t { if (plevel) --*plevel; } - inline bool ret (bool v) + inline bool ret (bool v, unsigned int line = 0) { if (unlikely (returned)) { fprintf (stderr, "OUCH, double calls to TRACE_RETURN. This is a bug, please report.\n"); return v; } - _hb_debug_msg (what, obj, NULL, true, plevel ? *plevel : 1, -1, "return %s", v ? "true" : "false"); + _hb_debug_msg (what, obj, NULL, true, plevel ? *plevel : 1, -1, "return %s (line %d)", v ? "true" : "false", line); if (plevel) --*plevel; plevel = NULL; returned = true; @@ -706,10 +706,10 @@ struct hb_auto_trace_t<0> { ...) {} template - inline T ret (T v) { return v; } + inline T ret (T v, unsigned int line = 0) { return v; } }; -#define TRACE_RETURN(RET) trace.ret (RET) +#define TRACE_RETURN(RET) trace.ret (RET, __LINE__) /* Misc */