2017-11-03 21:57:30 +01:00
|
|
|
/*
|
|
|
|
* Copyright © 2017 Google, Inc.
|
|
|
|
*
|
|
|
|
* This is part of HarfBuzz, a text shaping library.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, without written agreement and without
|
|
|
|
* license or royalty fees, to use, copy, modify, and distribute this
|
|
|
|
* software and its documentation for any purpose, provided that the
|
|
|
|
* above copyright notice and the following two paragraphs appear in
|
|
|
|
* all copies of this software.
|
|
|
|
*
|
|
|
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
|
|
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
|
|
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
* DAMAGE.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
|
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
|
|
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
|
|
*
|
|
|
|
* Google Author(s): Behdad Esfahbod
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_HH
|
|
|
|
#define HB_DEBUG_HH
|
|
|
|
|
2018-08-26 07:36:36 +02:00
|
|
|
#include "hb.hh"
|
|
|
|
#include "hb-atomic.hh"
|
2019-01-09 18:05:01 +01:00
|
|
|
#include "hb-algs.hh"
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG
|
|
|
|
#define HB_DEBUG 0
|
|
|
|
#endif
|
|
|
|
|
2018-08-01 06:05:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global runtime options.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct hb_options_t
|
|
|
|
{
|
2018-10-10 23:44:46 +02:00
|
|
|
bool unused : 1; /* In-case sign bit is here. */
|
|
|
|
bool initialized : 1;
|
|
|
|
bool uniscribe_bug_compatible : 1;
|
2018-08-01 06:05:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
union hb_options_union_t {
|
|
|
|
int i;
|
|
|
|
hb_options_t opts;
|
|
|
|
};
|
2018-09-16 19:33:48 +02:00
|
|
|
static_assert ((sizeof (hb_atomic_int_t) >= sizeof (hb_options_union_t)), "");
|
2018-08-01 06:05:51 +02:00
|
|
|
|
|
|
|
HB_INTERNAL void
|
2018-12-17 19:01:01 +01:00
|
|
|
_hb_options_init ();
|
2018-08-01 06:05:51 +02:00
|
|
|
|
|
|
|
extern HB_INTERNAL hb_atomic_int_t _hb_options;
|
|
|
|
|
|
|
|
static inline hb_options_t
|
2018-12-17 19:01:01 +01:00
|
|
|
hb_options ()
|
2018-08-01 06:05:51 +02:00
|
|
|
{
|
2019-05-11 08:15:58 +02:00
|
|
|
#ifdef HB_NO_GETENV
|
2019-04-12 22:21:58 +02:00
|
|
|
return hb_options_t ();
|
|
|
|
#endif
|
2018-08-01 06:05:51 +02:00
|
|
|
/* Make a local copy, so we can access bitfield threadsafely. */
|
|
|
|
hb_options_union_t u;
|
2022-08-03 20:54:03 +02:00
|
|
|
u.i = _hb_options;
|
2018-08-01 06:05:51 +02:00
|
|
|
|
|
|
|
if (unlikely (!u.i))
|
2018-09-10 18:19:37 +02:00
|
|
|
{
|
2018-08-01 06:05:51 +02:00
|
|
|
_hb_options_init ();
|
2022-08-03 20:54:03 +02:00
|
|
|
u.i = _hb_options;
|
2018-09-10 18:19:37 +02:00
|
|
|
}
|
2018-08-01 06:05:51 +02:00
|
|
|
|
|
|
|
return u.opts;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Debug output (needs enabling at compile time.)
|
|
|
|
*/
|
|
|
|
|
2017-11-03 21:57:30 +01:00
|
|
|
static inline bool
|
|
|
|
_hb_debug (unsigned int level,
|
|
|
|
unsigned int max_level)
|
|
|
|
{
|
|
|
|
return level < max_level;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DEBUG_LEVEL_ENABLED(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT))
|
|
|
|
#define DEBUG_ENABLED(WHAT) (DEBUG_LEVEL_ENABLED (WHAT, 0))
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_hb_print_func (const char *func)
|
|
|
|
{
|
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
unsigned int func_len = strlen (func);
|
|
|
|
/* Skip "static" */
|
|
|
|
if (0 == strncmp (func, "static ", 7))
|
|
|
|
func += 7;
|
|
|
|
/* Skip "typename" */
|
|
|
|
if (0 == strncmp (func, "typename ", 9))
|
|
|
|
func += 9;
|
|
|
|
/* Skip return type */
|
|
|
|
const char *space = strchr (func, ' ');
|
|
|
|
if (space)
|
|
|
|
func = space + 1;
|
|
|
|
/* Skip parameter list */
|
|
|
|
const char *paren = strchr (func, '(');
|
|
|
|
if (paren)
|
|
|
|
func_len = paren - func;
|
2023-01-13 01:04:24 +01:00
|
|
|
fprintf (stderr, "%.*s", (int) func_len, func);
|
2017-11-03 21:57:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <int max_level> static inline void
|
|
|
|
_hb_debug_msg_va (const char *what,
|
|
|
|
const void *obj,
|
|
|
|
const char *func,
|
|
|
|
bool indented,
|
|
|
|
unsigned int level,
|
|
|
|
int level_dir,
|
|
|
|
const char *message,
|
|
|
|
va_list ap) HB_PRINTF_FUNC(7, 0);
|
|
|
|
template <int max_level> static inline void
|
|
|
|
_hb_debug_msg_va (const char *what,
|
|
|
|
const void *obj,
|
|
|
|
const char *func,
|
|
|
|
bool indented,
|
|
|
|
unsigned int level,
|
|
|
|
int level_dir,
|
|
|
|
const char *message,
|
|
|
|
va_list ap)
|
|
|
|
{
|
|
|
|
if (!_hb_debug (level, max_level))
|
|
|
|
return;
|
|
|
|
|
|
|
|
fprintf (stderr, "%-10s", what ? what : "");
|
|
|
|
|
|
|
|
if (obj)
|
2023-01-21 22:36:26 +01:00
|
|
|
fprintf (stderr, "(%*p) ", (int) (2 * sizeof (void *)), obj);
|
2017-11-03 21:57:30 +01:00
|
|
|
else
|
2023-01-21 22:36:26 +01:00
|
|
|
fprintf (stderr, " %*s ", (int) (2 * sizeof (void *)), "");
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
if (indented) {
|
|
|
|
#define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
|
|
|
|
#define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
|
|
|
|
#define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT */
|
|
|
|
#define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
|
|
|
|
#define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
|
|
|
|
static const char bars[] =
|
|
|
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
|
|
|
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
|
|
|
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
|
|
|
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
|
|
|
|
VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
|
|
|
|
fprintf (stderr, "%2u %s" VRBAR "%s",
|
|
|
|
level,
|
2019-05-08 05:54:31 +02:00
|
|
|
bars + sizeof (bars) - 1 - hb_min ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
|
2017-11-03 21:57:30 +01:00
|
|
|
level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
|
|
|
|
} else
|
|
|
|
fprintf (stderr, " " VRBAR LBAR);
|
|
|
|
|
|
|
|
_hb_print_func (func);
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
{
|
|
|
|
fprintf (stderr, ": ");
|
|
|
|
vfprintf (stderr, message, ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (stderr, "\n");
|
|
|
|
}
|
2018-10-30 19:16:23 +01:00
|
|
|
template <> inline void HB_PRINTF_FUNC(7, 0)
|
2017-11-03 21:57:30 +01:00
|
|
|
_hb_debug_msg_va<0> (const char *what HB_UNUSED,
|
|
|
|
const void *obj HB_UNUSED,
|
|
|
|
const char *func HB_UNUSED,
|
|
|
|
bool indented HB_UNUSED,
|
|
|
|
unsigned int level HB_UNUSED,
|
|
|
|
int level_dir HB_UNUSED,
|
|
|
|
const char *message HB_UNUSED,
|
|
|
|
va_list ap HB_UNUSED) {}
|
|
|
|
|
|
|
|
template <int max_level> static inline void
|
|
|
|
_hb_debug_msg (const char *what,
|
|
|
|
const void *obj,
|
|
|
|
const char *func,
|
|
|
|
bool indented,
|
|
|
|
unsigned int level,
|
|
|
|
int level_dir,
|
|
|
|
const char *message,
|
|
|
|
...) HB_PRINTF_FUNC(7, 8);
|
2018-10-30 19:16:23 +01:00
|
|
|
template <int max_level> static inline void HB_PRINTF_FUNC(7, 8)
|
2017-11-03 21:57:30 +01:00
|
|
|
_hb_debug_msg (const char *what,
|
|
|
|
const void *obj,
|
|
|
|
const char *func,
|
|
|
|
bool indented,
|
|
|
|
unsigned int level,
|
|
|
|
int level_dir,
|
|
|
|
const char *message,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start (ap, message);
|
|
|
|
_hb_debug_msg_va<max_level> (what, obj, func, indented, level, level_dir, message, ap);
|
|
|
|
va_end (ap);
|
|
|
|
}
|
|
|
|
template <> inline void
|
|
|
|
_hb_debug_msg<0> (const char *what HB_UNUSED,
|
|
|
|
const void *obj HB_UNUSED,
|
|
|
|
const char *func HB_UNUSED,
|
|
|
|
bool indented HB_UNUSED,
|
|
|
|
unsigned int level HB_UNUSED,
|
|
|
|
int level_dir HB_UNUSED,
|
|
|
|
const char *message HB_UNUSED,
|
|
|
|
...) HB_PRINTF_FUNC(7, 8);
|
2018-10-30 19:16:23 +01:00
|
|
|
template <> inline void HB_PRINTF_FUNC(7, 8)
|
2017-11-03 21:57:30 +01:00
|
|
|
_hb_debug_msg<0> (const char *what HB_UNUSED,
|
|
|
|
const void *obj HB_UNUSED,
|
|
|
|
const char *func HB_UNUSED,
|
|
|
|
bool indented HB_UNUSED,
|
|
|
|
unsigned int level HB_UNUSED,
|
|
|
|
int level_dir HB_UNUSED,
|
|
|
|
const char *message HB_UNUSED,
|
|
|
|
...) {}
|
|
|
|
|
|
|
|
#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
|
2019-12-31 13:23:02 +01:00
|
|
|
#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, false, 0, 0, __VA_ARGS__)
|
2017-11-03 21:57:30 +01:00
|
|
|
#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Printer
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct hb_printer_t {
|
|
|
|
const char *print (const T&) { return "something"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct hb_printer_t<bool> {
|
|
|
|
const char *print (bool v) { return v ? "true" : "false"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
2019-05-11 05:43:26 +02:00
|
|
|
struct hb_printer_t<hb_empty_t> {
|
|
|
|
const char *print (hb_empty_t) { return ""; }
|
2017-11-03 21:57:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Trace
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
static inline void _hb_warn_no_return (bool returned)
|
|
|
|
{
|
|
|
|
if (unlikely (!returned)) {
|
|
|
|
fprintf (stderr, "OUCH, returned with no call to return_trace(). This is a bug, please report.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <>
|
2019-05-11 05:43:26 +02:00
|
|
|
/*static*/ inline void _hb_warn_no_return<hb_empty_t> (bool returned HB_UNUSED)
|
2017-11-03 21:57:30 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
template <int max_level, typename ret_t>
|
2017-12-15 03:15:14 +01:00
|
|
|
struct hb_auto_trace_t
|
|
|
|
{
|
2017-11-03 21:57:30 +01:00
|
|
|
explicit inline hb_auto_trace_t (unsigned int *plevel_,
|
|
|
|
const char *what_,
|
|
|
|
const void *obj_,
|
|
|
|
const char *func,
|
|
|
|
const char *message,
|
2017-11-14 23:40:21 +01:00
|
|
|
...) HB_PRINTF_FUNC(6, 7)
|
|
|
|
: plevel (plevel_), what (what_), obj (obj_), returned (false)
|
2017-11-03 21:57:30 +01:00
|
|
|
{
|
|
|
|
if (plevel) ++*plevel;
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
va_start (ap, message);
|
|
|
|
_hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap);
|
|
|
|
va_end (ap);
|
|
|
|
}
|
2018-12-17 19:01:01 +01:00
|
|
|
~hb_auto_trace_t ()
|
2017-11-03 21:57:30 +01:00
|
|
|
{
|
|
|
|
_hb_warn_no_return<ret_t> (returned);
|
|
|
|
if (!returned) {
|
|
|
|
_hb_debug_msg<max_level> (what, obj, nullptr, true, plevel ? *plevel : 1, -1, " ");
|
|
|
|
}
|
|
|
|
if (plevel) --*plevel;
|
|
|
|
}
|
|
|
|
|
2019-08-23 20:54:20 +02:00
|
|
|
template <typename T>
|
|
|
|
T ret (T&& v,
|
2019-08-23 21:24:15 +02:00
|
|
|
const char *func = "",
|
|
|
|
unsigned int line = 0)
|
2017-11-03 21:57:30 +01:00
|
|
|
{
|
|
|
|
if (unlikely (returned)) {
|
|
|
|
fprintf (stderr, "OUCH, double calls to return_trace(). This is a bug, please report.\n");
|
2021-11-02 07:18:22 +01:00
|
|
|
return std::forward<T> (v);
|
2017-11-03 21:57:30 +01:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:32:17 +01:00
|
|
|
_hb_debug_msg<max_level> (what, obj, func, true, plevel ? *plevel : 1, -1,
|
2023-01-21 22:36:26 +01:00
|
|
|
"return %s (line %u)",
|
2021-07-22 20:09:02 +02:00
|
|
|
hb_printer_t<hb_decay<decltype (v)>>().print (v), line);
|
2017-11-03 21:57:30 +01:00
|
|
|
if (plevel) --*plevel;
|
|
|
|
plevel = nullptr;
|
|
|
|
returned = true;
|
2021-11-02 07:18:22 +01:00
|
|
|
return std::forward<T> (v);
|
2017-11-03 21:57:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned int *plevel;
|
|
|
|
const char *what;
|
|
|
|
const void *obj;
|
|
|
|
bool returned;
|
|
|
|
};
|
2017-11-03 22:16:26 +01:00
|
|
|
template <typename ret_t> /* Make sure we don't use hb_auto_trace_t when not tracing. */
|
2017-12-15 03:15:14 +01:00
|
|
|
struct hb_auto_trace_t<0, ret_t>
|
|
|
|
{
|
|
|
|
explicit inline hb_auto_trace_t (unsigned int *plevel_,
|
|
|
|
const char *what_,
|
|
|
|
const void *obj_,
|
|
|
|
const char *func,
|
|
|
|
const char *message,
|
|
|
|
...) HB_PRINTF_FUNC(6, 7) {}
|
|
|
|
|
2019-05-03 01:20:03 +02:00
|
|
|
template <typename T>
|
|
|
|
T ret (T&& v,
|
|
|
|
const char *func HB_UNUSED = nullptr,
|
2021-11-02 07:18:22 +01:00
|
|
|
unsigned int line HB_UNUSED = 0) { return std::forward<T> (v); }
|
2017-12-15 03:15:14 +01:00
|
|
|
};
|
2017-11-03 21:57:30 +01:00
|
|
|
|
2017-11-03 22:16:26 +01:00
|
|
|
/* For disabled tracing; optimize out everything.
|
2017-11-20 20:49:22 +01:00
|
|
|
* https://github.com/harfbuzz/harfbuzz/pull/605 */
|
2017-11-03 22:16:26 +01:00
|
|
|
template <typename ret_t>
|
|
|
|
struct hb_no_trace_t {
|
2019-05-03 01:20:03 +02:00
|
|
|
template <typename T>
|
|
|
|
T ret (T&& v,
|
|
|
|
const char *func HB_UNUSED = nullptr,
|
2021-11-02 07:18:22 +01:00
|
|
|
unsigned int line HB_UNUSED = 0) { return std::forward<T> (v); }
|
2017-11-03 21:57:30 +01:00
|
|
|
};
|
|
|
|
|
2018-11-25 04:32:17 +01:00
|
|
|
#define return_trace(RET) return trace.ret (RET, HB_FUNC, __LINE__)
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Instances.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_ARABIC
|
|
|
|
#define HB_DEBUG_ARABIC (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_BLOB
|
|
|
|
#define HB_DEBUG_BLOB (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_CORETEXT
|
|
|
|
#define HB_DEBUG_CORETEXT (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_DIRECTWRITE
|
|
|
|
#define HB_DEBUG_DIRECTWRITE (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_FT
|
|
|
|
#define HB_DEBUG_FT (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
2023-03-01 18:59:04 +01:00
|
|
|
#ifndef HB_DEBUG_JUSTIFY
|
|
|
|
#define HB_DEBUG_JUSTIFY (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
2017-11-03 21:57:30 +01:00
|
|
|
#ifndef HB_DEBUG_OBJECT
|
|
|
|
#define HB_DEBUG_OBJECT (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_SHAPE_PLAN
|
|
|
|
#define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_UNISCRIBE
|
|
|
|
#define HB_DEBUG_UNISCRIBE (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* With tracing.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HB_DEBUG_APPLY
|
|
|
|
#define HB_DEBUG_APPLY (HB_DEBUG+0)
|
|
|
|
#endif
|
2017-11-03 22:16:26 +01:00
|
|
|
#if HB_DEBUG_APPLY
|
2017-11-03 21:57:30 +01:00
|
|
|
#define TRACE_APPLY(this) \
|
|
|
|
hb_auto_trace_t<HB_DEBUG_APPLY, bool> trace \
|
|
|
|
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
2023-01-21 22:36:26 +01:00
|
|
|
"idx %u gid %u lookup %d", \
|
2017-11-03 22:16:26 +01:00
|
|
|
c->buffer->idx, c->buffer->cur().codepoint, (int) c->lookup_index)
|
|
|
|
#else
|
|
|
|
#define TRACE_APPLY(this) hb_no_trace_t<bool> trace
|
|
|
|
#endif
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
#ifndef HB_DEBUG_SANITIZE
|
|
|
|
#define HB_DEBUG_SANITIZE (HB_DEBUG+0)
|
|
|
|
#endif
|
2017-11-03 22:16:26 +01:00
|
|
|
#if HB_DEBUG_SANITIZE
|
2017-11-03 21:57:30 +01:00
|
|
|
#define TRACE_SANITIZE(this) \
|
|
|
|
hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \
|
|
|
|
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
2019-08-23 21:25:58 +02:00
|
|
|
" ")
|
2017-11-03 22:16:26 +01:00
|
|
|
#else
|
|
|
|
#define TRACE_SANITIZE(this) hb_no_trace_t<bool> trace
|
|
|
|
#endif
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
#ifndef HB_DEBUG_SERIALIZE
|
|
|
|
#define HB_DEBUG_SERIALIZE (HB_DEBUG+0)
|
|
|
|
#endif
|
2017-11-03 22:16:26 +01:00
|
|
|
#if HB_DEBUG_SERIALIZE
|
2017-11-03 21:57:30 +01:00
|
|
|
#define TRACE_SERIALIZE(this) \
|
|
|
|
hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \
|
|
|
|
(&c->debug_depth, "SERIALIZE", c, HB_FUNC, \
|
2019-08-23 21:25:58 +02:00
|
|
|
" ")
|
2017-11-03 22:16:26 +01:00
|
|
|
#else
|
|
|
|
#define TRACE_SERIALIZE(this) hb_no_trace_t<bool> trace
|
|
|
|
#endif
|
2017-11-03 21:57:30 +01:00
|
|
|
|
2018-02-07 18:31:31 +01:00
|
|
|
#ifndef HB_DEBUG_SUBSET
|
|
|
|
#define HB_DEBUG_SUBSET (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
#if HB_DEBUG_SUBSET
|
|
|
|
#define TRACE_SUBSET(this) \
|
|
|
|
hb_auto_trace_t<HB_DEBUG_SUBSET, bool> trace \
|
|
|
|
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
2019-08-23 21:25:58 +02:00
|
|
|
" ")
|
2018-02-07 18:31:31 +01:00
|
|
|
#else
|
|
|
|
#define TRACE_SUBSET(this) hb_no_trace_t<bool> trace
|
|
|
|
#endif
|
|
|
|
|
2020-11-06 01:39:23 +01:00
|
|
|
#ifndef HB_DEBUG_SUBSET_REPACK
|
|
|
|
#define HB_DEBUG_SUBSET_REPACK (HB_DEBUG+0)
|
|
|
|
#endif
|
|
|
|
|
2017-11-03 22:16:26 +01:00
|
|
|
#ifndef HB_DEBUG_DISPATCH
|
|
|
|
#define HB_DEBUG_DISPATCH ( \
|
|
|
|
HB_DEBUG_APPLY + \
|
|
|
|
HB_DEBUG_SANITIZE + \
|
|
|
|
HB_DEBUG_SERIALIZE + \
|
2019-03-30 06:12:42 +01:00
|
|
|
HB_DEBUG_SUBSET + \
|
2017-11-03 22:16:26 +01:00
|
|
|
0)
|
|
|
|
#endif
|
|
|
|
#if HB_DEBUG_DISPATCH
|
2017-11-03 21:57:30 +01:00
|
|
|
#define TRACE_DISPATCH(this, format) \
|
|
|
|
hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t> trace \
|
|
|
|
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
2023-01-21 22:36:26 +01:00
|
|
|
"format %u", (unsigned) format)
|
2017-11-03 22:16:26 +01:00
|
|
|
#else
|
|
|
|
#define TRACE_DISPATCH(this, format) hb_no_trace_t<typename context_t::return_t> trace
|
|
|
|
#endif
|
2017-11-03 21:57:30 +01:00
|
|
|
|
|
|
|
|
2022-07-25 01:14:09 +02:00
|
|
|
#ifndef HB_BUFFER_MESSAGE_MORE
|
|
|
|
#define HB_BUFFER_MESSAGE_MORE (HB_DEBUG+1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2017-11-03 21:57:30 +01:00
|
|
|
#endif /* HB_DEBUG_HH */
|