Define HB_FUNC for portability to non-gcc

This commit is contained in:
Behdad Esfahbod 2010-04-29 13:54:01 -04:00
parent fa030175ca
commit 7d3a126334
3 changed files with 16 additions and 7 deletions

View File

@ -127,7 +127,7 @@ ASSERT_STATIC (sizeof (Type) + 1 <= sizeof (_Null##Type))
#define TRACE_SANITIZE() \ #define TRACE_SANITIZE() \
HB_STMT_START { \ HB_STMT_START { \
if (HB_DEBUG_SANITIZE) \ if (HB_DEBUG_SANITIZE) \
_hb_trace ("SANITIZE", __PRETTY_FUNCTION__, this, sanitize_depth, HB_DEBUG_SANITIZE); \ _hb_trace ("SANITIZE", HB_FUNC, this, sanitize_depth, HB_DEBUG_SANITIZE); \
} HB_STMT_END } HB_STMT_END
@ -266,7 +266,7 @@ struct Sanitizer
retry: retry:
if (HB_DEBUG_SANITIZE) if (HB_DEBUG_SANITIZE)
fprintf (stderr, "Sanitizer %p start %s\n", blob, __PRETTY_FUNCTION__); fprintf (stderr, "Sanitizer %p start %s\n", blob, HB_FUNC);
_hb_sanitize_init (context, blob); _hb_sanitize_init (context, blob);
@ -277,7 +277,7 @@ struct Sanitizer
if (context->edit_count) { if (context->edit_count) {
if (HB_DEBUG_SANITIZE) if (HB_DEBUG_SANITIZE)
fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n", fprintf (stderr, "Sanitizer %p passed first round with %d edits; doing a second round %s\n",
blob, context->edit_count, __PRETTY_FUNCTION__); blob, context->edit_count, HB_FUNC);
/* sanitize again to ensure no toe-stepping */ /* sanitize again to ensure no toe-stepping */
context->edit_count = 0; context->edit_count = 0;
@ -285,7 +285,7 @@ struct Sanitizer
if (context->edit_count) { if (context->edit_count) {
if (HB_DEBUG_SANITIZE) if (HB_DEBUG_SANITIZE)
fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n", fprintf (stderr, "Sanitizer %p requested %d edits in second round; FAILLING %s\n",
blob, context->edit_count, __PRETTY_FUNCTION__); blob, context->edit_count, HB_FUNC);
sane = false; sane = false;
} }
} }
@ -296,13 +296,13 @@ struct Sanitizer
if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) { if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
/* ok, we made it writable by relocating. try again */ /* ok, we made it writable by relocating. try again */
if (HB_DEBUG_SANITIZE) if (HB_DEBUG_SANITIZE)
fprintf (stderr, "Sanitizer %p retry %s\n", blob, __PRETTY_FUNCTION__); fprintf (stderr, "Sanitizer %p retry %s\n", blob, HB_FUNC);
goto retry; goto retry;
} }
} }
if (HB_DEBUG_SANITIZE) if (HB_DEBUG_SANITIZE)
fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", __PRETTY_FUNCTION__); fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", HB_FUNC);
if (sane) if (sane)
return blob; return blob;
else { else {

View File

@ -38,7 +38,7 @@
#define TRACE_APPLY() \ #define TRACE_APPLY() \
HB_STMT_START { \ HB_STMT_START { \
if (HB_DEBUG_APPLY) \ if (HB_DEBUG_APPLY) \
_hb_trace ("APPLY", __PRETTY_FUNCTION__, this, apply_depth, HB_DEBUG_APPLY); \ _hb_trace ("APPLY", HB_FUNC, this, apply_depth, HB_DEBUG_APPLY); \
} HB_STMT_END } HB_STMT_END

View File

@ -145,6 +145,15 @@
#endif #endif
#if __GNUC__ >= 3
#define HB_FUNC __PRETTY_FUNCTION__
#elif defined(_MSC_VER)
#define HB_FUNC __FUNCSIG__
#else
#define HB_FUNC __func__
#endif
/* Return the number of 1 bits in mask. /* Return the number of 1 bits in mask.
* *
* GCC 3.4 supports a "population count" builtin, which on many targets is * GCC 3.4 supports a "population count" builtin, which on many targets is