Fix clang -Wcomma warnings

Fixes https://github.com/harfbuzz/harfbuzz/issues/3656
This commit is contained in:
Behdad Esfahbod 2022-06-15 16:57:16 -06:00
parent d9c18cc2f0
commit e9c0a74063
6 changed files with 9 additions and 8 deletions

View File

@ -100,7 +100,7 @@ struct hb_bit_set_invertible_t
void add (hb_codepoint_t g) { unlikely (inverted) ? s.del (g) : s.add (g); } void add (hb_codepoint_t g) { unlikely (inverted) ? s.del (g) : s.add (g); }
bool add_range (hb_codepoint_t a, hb_codepoint_t b) bool add_range (hb_codepoint_t a, hb_codepoint_t b)
{ return unlikely (inverted) ? (s.del_range (a, b), true) : s.add_range (a, b); } { return unlikely (inverted) ? ((void) s.del_range (a, b), true) : s.add_range (a, b); }
template <typename T> template <typename T>
void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T)) void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))

View File

@ -1151,7 +1151,7 @@ resize_and_retry:
pos->x_offset = info->var1.i32; pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32; pos->y_offset = info->var2.i32;
info++, pos++; info++; pos++;
} }
else else
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -1160,7 +1160,7 @@ resize_and_retry:
pos->x_offset = info->var1.i32; pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32; pos->y_offset = info->var2.i32;
info++, pos++; info++; pos++;
} }
/* Fix up clusters so that we never return out-of-order indices; /* Fix up clusters so that we never return out-of-order indices;

View File

@ -213,7 +213,7 @@ struct fvar
if (!axis_index) axis_index = &i; if (!axis_index) axis_index = &i;
*axis_index = HB_OT_VAR_NO_AXIS_INDEX; *axis_index = HB_OT_VAR_NO_AXIS_INDEX;
auto axes = get_axes (); auto axes = get_axes ();
return axes.lfind (tag, axis_index) && (axes[*axis_index].get_axis_deprecated (info), true); return axes.lfind (tag, axis_index) && ((void) axes[*axis_index].get_axis_deprecated (info), true);
} }
#endif #endif
bool bool
@ -221,7 +221,7 @@ struct fvar
{ {
unsigned i; unsigned i;
auto axes = get_axes (); auto axes = get_axes ();
return axes.lfind (tag, &i) && (axes[i].get_axis_info (i, info), true); return axes.lfind (tag, &i) && ((void) axes[i].get_axis_info (i, info), true);
} }
int normalize_axis_value (unsigned int axis_index, float v) const int normalize_axis_value (unsigned int axis_index, float v) const

View File

@ -760,7 +760,7 @@ struct graph_t
} }
bool check_success (bool success) bool check_success (bool success)
{ return this->successful && (success || (err_other_error (), false)); } { return this->successful && (success || ((void) err_other_error (), false)); }
/* /*
* Creates a map from objid to # of incoming edges. * Creates a map from objid to # of incoming edges.

View File

@ -336,7 +336,7 @@ _is_table_present (hb_face_t *source, hb_tag_t tag)
hb_tag_t table_tags[32]; hb_tag_t table_tags[32];
unsigned offset = 0, num_tables = ARRAY_LENGTH (table_tags); unsigned offset = 0, num_tables = ARRAY_LENGTH (table_tags);
while ((hb_face_get_table_tags (source, offset, &num_tables, table_tags), num_tables)) while (((void) hb_face_get_table_tags (source, offset, &num_tables, table_tags), num_tables))
{ {
for (unsigned i = 0; i < num_tables; ++i) for (unsigned i = 0; i < num_tables; ++i)
if (table_tags[i] == tag) if (table_tags[i] == tag)
@ -499,7 +499,7 @@ hb_subset_plan_execute_or_fail (hb_subset_plan_t *plan)
hb_vector_t<char> buf; hb_vector_t<char> buf;
buf.alloc (4096 - 16); buf.alloc (4096 - 16);
while ((_get_table_tags (plan, offset, &num_tables, table_tags), num_tables)) while (((void) _get_table_tags (plan, offset, &num_tables, table_tags), num_tables))
{ {
for (unsigned i = 0; i < num_tables; ++i) for (unsigned i = 0; i < num_tables; ++i)
{ {

View File

@ -64,6 +64,7 @@
#pragma GCC diagnostic error "-Wbitwise-instead-of-logical" #pragma GCC diagnostic error "-Wbitwise-instead-of-logical"
#pragma GCC diagnostic error "-Wcast-align" #pragma GCC diagnostic error "-Wcast-align"
#pragma GCC diagnostic error "-Wcast-function-type" #pragma GCC diagnostic error "-Wcast-function-type"
#pragma GCC diagnostic error "-Wcomma"
#pragma GCC diagnostic error "-Wdelete-non-virtual-dtor" #pragma GCC diagnostic error "-Wdelete-non-virtual-dtor"
#pragma GCC diagnostic error "-Wembedded-directive" #pragma GCC diagnostic error "-Wembedded-directive"
#pragma GCC diagnostic error "-Wextra-semi-stmt" #pragma GCC diagnostic error "-Wextra-semi-stmt"