diff --git a/src/Makefile.am b/src/Makefile.am index 2a3d6c79aa7f45c6f1c11f6be2c67fb9987f7425..839f8997ac8f41090753eb3d774396d0c432dc76 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 c3184cf7653e49f51a2a8d0f153c030f9c159534..fee5949803f95d90ff20d12298d68e9714695b37 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 ea2a70d5b07e7feeeeb7cab56f5e1c486f387428..ea639559fc595bd76b758c63c7c1d6e9e46f7fec 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 7afb25803fb0fa69c315279c51d05870dd22c42a..179e4e9f7418f487475809ef6449b0ef775d54e3 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