summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2010-04-28 20:25:22 -0400
committerBehdad Esfahbod <behdad@behdad.org>2010-04-28 23:28:07 -0400
commit807c5b03a2251a3c29a520852639421783101b55 (patch)
tree94715302a7b99d635151aa416295b6985a1183a1
parent74e313c016704e1d9157c2763691c4151f049dfc (diff)
[sanitize] Make debug code always available to the compiler
Such that we don't break debug build all the time.
-rw-r--r--src/hb-open-type-private.hh31
-rw-r--r--src/hb-ot-layout-gsubgpos-private.hh2
2 files changed, 21 insertions, 12 deletions
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index f64526c..64acb1b 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -121,27 +121,36 @@ ASSERT_STATIC (sizeof (Type) + 1 <= sizeof (_Null##Type))
*/
#ifndef HB_DEBUG_SANITIZE
-#define HB_DEBUG_SANITIZE HB_DEBUG
+#define HB_DEBUG_SANITIZE HB_DEBUG+0
#endif
+static HB_GNUC_UNUSED inline hb_bool_t /* always returns TRUE */
+_hb_trace (const char *what,
+ const char *function,
+ void *obj,
+ unsigned int depth,
+ unsigned int max_depth)
+{
+ if (depth < max_depth)
+ fprintf (stderr, "%s(%p) %-*d-> %s\n",
+ what,
+ (obj == CharP(&_NullPool)) ? 0 : obj,
+ depth, depth,
+ function);
+ return TRUE;
+}
+
+
#if HB_DEBUG_SANITIZE
-#include <stdio.h>
+#define TRACE_SANITIZE() _hb_trace ("SANITIZE", __PRETTY_FUNCTION__, this, sanitize_depth, HB_DEBUG_SANITIZE)
#define TRACE_SANITIZE_ARG_DEF , unsigned int sanitize_depth HB_GNUC_UNUSED
#define TRACE_SANITIZE_ARG , sanitize_depth + 1
#define TRACE_SANITIZE_ARG_INIT , 1
-#define TRACE_SANITIZE() \
- HB_STMT_START { \
- if (sanitize_depth < HB_DEBUG_SANITIZE) \
- fprintf (stderr, "SANITIZE(%p) %-*d-> %s\n", \
- (CharP(this) == CharP(&_NullPool)) ? 0 : this, \
- sanitize_depth, sanitize_depth, \
- __PRETTY_FUNCTION__); \
- } HB_STMT_END
#else
+#define TRACE_SANITIZE() _hb_trace ("SANITIZE", __PRETTY_FUNCTION__, this, 0, HB_DEBUG_SANITIZE)
#define TRACE_SANITIZE_ARG_DEF
#define TRACE_SANITIZE_ARG
#define TRACE_SANITIZE_ARG_INIT
-#define TRACE_SANITIZE() HB_STMT_START {} HB_STMT_END
#endif
#define SANITIZE_ARG_DEF \
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 629be6c..979026d 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -40,7 +40,7 @@ _hb_trace_apply (const char *obj,
unsigned int apply_depth,
const char *function)
{
- /* The following check is written in such a skewer way just
+ /* The following check is written in such a skewed way just
* to quiet compiler warning. The simple version would have been:
* if (apply_depth < HB_DEBUG_APPLY)
*/