Skip to content

Commit

Permalink
Fix hb_in_range() unused-var warning on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Jul 17, 2014
1 parent e3b42f1 commit 385cf37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hb-private.hh
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,13 @@ template <> class hb_assert_unsigned_t<unsigned long> {};
template <typename T> static inline bool
hb_in_range (T u, T lo, T hi)
{
hb_assert_unsigned_t<T> error_hb_in_range_called_with_signed_type HB_UNUSED;
/* The sizeof() is here to force template instantiation.
* I'm sure there are better ways to do this but can't think of
* one right now. Declaring a variable won't work as HB_UNUSED
* is unsable on some platforms and unused types are less likely
* to generate a warning than unused variables. */
ASSERT_STATIC (sizeof (hb_assert_unsigned_t<T>) >= 0);

return (u - lo) <= (hi - lo);
}

Expand Down

0 comments on commit 385cf37

Please sign in to comment.