Skip to content

Commit 02334e9

Browse files
authored
Merge pull request #117 from cor3ntin/fix_gcc_warnings
Update unicode-db.hpp to fix gcc 10 warnings
2 parents 1ab1d9d + 63ea49f commit 02334e9

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

include/unicode-db/unicode-db.hpp

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,31 +239,40 @@ struct bool_trie {
239239
constexpr bool lookup(char32_t u) const {
240240
std::uint32_t c = u;
241241
if(c < 0x800) {
242-
if constexpr(r1_s == 0)
242+
if constexpr(r1_s == 0) {
243243
return false;
244-
return trie_range_leaf(c, r1[c >> 6]);
244+
} else {
245+
return trie_range_leaf(c, r1[c >> 6]);
246+
}
245247
} else if(c < 0x10000) {
246-
if constexpr(r3_s == 0)
248+
if constexpr(r3_s == 0) {
247249
return false;
248-
std::size_t i = ((c >> 6) - 0x20);
249-
auto child = 0;
250-
if(i >= r2_t_f && i < r2_t_f + r2_s)
251-
child = r2[i - r2_t_f];
252-
253-
return trie_range_leaf(c, r3[child]);
250+
} else {
251+
std::size_t i = ((c >> 6) - 0x20);
252+
auto child = 0;
253+
if(i >= r2_t_f && i < r2_t_f + r2_s)
254+
child = r2[i - r2_t_f];
255+
return trie_range_leaf(c, r3[child]);
256+
}
254257
} else {
255-
if constexpr(r6_s == 0)
258+
if constexpr(r6_s == 0) {
256259
return false;
260+
}
257261
std::size_t i4 = (c >> 12) - 0x10;
258262
auto child = 0;
259-
if(i4 >= r4_t_f && i4 < r4_t_f + r4_s)
260-
child = r4[i4 - r4_t_f];
261-
263+
if constexpr(r4_s > 0) {
264+
if(i4 >= r4_t_f && i4 < r4_t_f + r4_s) {
265+
child = r4[i4 - r4_t_f];
266+
}
267+
}
262268

263269
std::size_t i5 = (child << 6) + ((c >> 6) & 0x3f);
264270
auto leaf = 0;
265-
if(i5 >= r5_t_f && i5 < r5_t_f + r5_s)
266-
leaf = r5[i5 - r5_t_f];
271+
if constexpr(r5_s > 0) {
272+
if(i5 >= r5_t_f && i5 < r5_t_f + r5_s) {
273+
leaf = r5[i5 - r5_t_f];
274+
}
275+
}
267276
return trie_range_leaf(c, r6[leaf]);
268277
}
269278
}
@@ -9681,4 +9690,4 @@ constexpr bool is_unknown(binary_prop s)
96819690
return s == binary_prop::unknown;
96829691
}
96839692

9684-
} // namespace uni::detail
9693+
} // namespace uni::detail

0 commit comments

Comments
 (0)