Fix some unused-var warnings under NDEBUG

This commit is contained in:
Behdad Esfahbod committed 2026-01-10 07:42:07 -07:00
1 parent 4ca351535b
commit bb7dbc25ec
4 files changed
+20 -19

No files matched your search

+14 -15
View File
@@ -41,7 +41,6 @@
#include "hb-cplusplus.hh"
#include <cassert>
#include <functional>
#include <utility>
@@ -52,28 +51,28 @@ test_smart_ptrs (void)
hb::shared_ptr<hb_buffer_t> pb {b};
/* Test copy-construction. */
assert (bool (pb));
g_assert_true (bool (pb));
hb::shared_ptr<hb_buffer_t> pb2 {pb};
assert (bool (pb2));
assert (bool (pb));
g_assert_true (bool (pb2));
g_assert_true (bool (pb));
/* Test move-construction. */
assert (bool (pb2));
g_assert_true (bool (pb2));
hb::shared_ptr<hb_buffer_t> pb4 {std::move (pb2)};
assert (!bool (pb2));
assert (bool (pb4));
g_assert_true (!bool (pb2));
g_assert_true (bool (pb4));
/* Test copy-assignment. */
hb::shared_ptr<hb_buffer_t> pb3;
assert (!bool (pb3));
g_assert_true (!bool (pb3));
pb3 = pb;
assert (bool (pb3));
assert (bool (pb));
g_assert_true (bool (pb3));
g_assert_true (bool (pb));
/* Test move-assignment. */
assert (bool (pb));
g_assert_true (bool (pb));
pb2 = std::move (pb);
assert (!bool (pb));
g_assert_true (!bool (pb));
pb.reference ();
pb.destroy ();
@@ -96,9 +95,9 @@ test_smart_ptrs (void)
std::hash<hb::shared_ptr<hb_buffer_t>> hash2 {};
std::hash<hb::unique_ptr<hb_buffer_t>> hash3 {};
assert (hash (b) == hash2 (pb4));
assert (hash2 (pb4) == hash2 (pb2));
assert (hash (b) == hash3 (pb5));
g_assert_true (hash (b) == hash2 (pb4));
g_assert_true (hash2 (pb4) == hash2 (pb2));
g_assert_true (hash (b) == hash3 (pb5));
g_assert_true (pb != pb.get_empty ());
g_assert_true (pb != pb2);
+2 -2
View File
@@ -142,10 +142,10 @@ test_get_table_tags_ct (void)
hb_blob_get_data (blob, NULL),
hb_blob_get_length (blob),
NULL);
assert (provider);
g_assert_true (provider);
CGFontRef cg_font = CGFontCreateWithDataProvider (provider);
assert (cg_font);
g_assert_true (cg_font);
CGDataProviderRelease (provider);
hb_face_t *face = hb_coretext_face_create (cg_font);
+2 -1
View File
@@ -34,7 +34,8 @@ trySubset (hb_face_t *face,
unsigned int bytes_count = 0;
for (unsigned int i = 0; i < length; ++i)
if (data[i]) ++bytes_count;
assert (bytes_count || !length);
if (!(bytes_count || !length))
abort ();
hb_blob_destroy (blob);
}
+2 -1
View File
@@ -126,7 +126,8 @@ static void test_backend (const char *backend,
}
bool ret = hb_font_set_funcs_using (font, backend);
assert (ret);
if (!ret)
abort ();
std::vector<std::thread> threads;
for (unsigned i = 0; i < num_threads; i++)