[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Feb 25 05:00:14 UTC 2016


 src/Makefile.am          |    2 +-
 src/hb-buffer-private.hh |    4 ++--
 src/hb-buffer.cc         |    4 ++--
 src/hb-private.hh        |    9 +++++++++
 4 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 91dd11565221bdb108c138662ea013aac14bb968
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 25 13:56:47 2016 +0900

    Add HB_NDEBUG
    
    API changes:
    - If NDEBUG is defined, define HB_NDEBUG
    - Disable costlier sanity checks if HB_NDEBUG is defined.
    
    In 1.2.3 introduced some code to disable costly sanity checks if
    NDEBUG is defined.  NDEBUG, however, disables all assert()s as
    well.  With HB_NDEBUG, one can disable costlier checks but keep
    assert()s.
    
    I'll probably add a way to define HB_NDEBUG automatically in
    release tarballs.  But for now, production systems that do NOT
    define NDEBUG, are encouraged to define HB_NDEBUG for our build.

diff --git a/src/Makefile.am b/src/Makefile.am
index 2a3d6c7..839f899 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,7 +130,7 @@ pkgconfig_DATA = harfbuzz.pc
 EXTRA_DIST += harfbuzz.pc.in
 
 FUZZING_CPPFLAGS= \
-	-DNDEBUG \
+	-DHB_NDEBUG \
 	-DHB_MAX_NESTING_LEVEL=3 \
 	-DHB_SANITIZE_MAX_EDITS=3 \
 	-DHB_BUFFER_MAX_EXPANSION_FACTOR=3 \
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index c3184cf..fee5949 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -124,7 +124,7 @@ struct hb_buffer_t {
   void *message_data;
   hb_destroy_func_t message_destroy;
 
-#ifndef NDEBUG
+#ifndef HB_NDEBUG
   /* Internal debugging. */
   /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
   uint8_t allocated_var_bytes[8];
@@ -260,7 +260,7 @@ struct hb_buffer_t {
 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
   b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
 	   sizeof (b->info[0].var), owner)
-#ifndef NDEBUG
+#ifndef HB_NDEBUG
 #define HB_BUFFER_ALLOCATE_VAR(b, var) \
 	HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index ea2a70d..ea63955 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -661,7 +661,7 @@ hb_buffer_t::guess_segment_properties (void)
 }
 
 
-#ifndef NDEBUG
+#ifndef HB_NDEBUG
 static inline void
 dump_var_allocation (const hb_buffer_t *buffer)
 {
@@ -729,7 +729,7 @@ void hb_buffer_t::deallocate_var_all (void)
   memset (allocated_var_bytes, 0, sizeof (allocated_var_bytes));
   memset (allocated_var_owner, 0, sizeof (allocated_var_owner));
 }
-#endif /* NDEBUG */
+#endif /* HB_NDEBUG */
 
 /* Public API */
 
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 7afb258..179e4e9 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -611,6 +611,15 @@ static inline unsigned char TOLOWER (unsigned char c)
 /* Debug */
 
 
+/* HB_NDEBUG disables some sanity checks that are very safe to disable and
+ * should be disabled in production systems.  If NDEBUG is defined, enable
+ * HB_NDEBUG; but if it's desirable that normal assert()s (which are very
+ * light-weight) to be enabled, then HB_DEBUG can be defined to disable
+ * the costlier checks. */
+#ifdef NDEBUG
+#define HB_NDEBUG
+#endif
+
 #ifndef HB_DEBUG
 #define HB_DEBUG 0
 #endif


More information about the HarfBuzz mailing list