From a6fb8ce98a6ee7b62fe42e233c946a427587bbd7 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 4 Jul 2020 23:43:21 +0430 Subject: [PATCH] Minor, fix -Wrange-loop-analysis warnings Fixing these complains raised by newer versions of clang, ./hb-ot-layout-common.hh:1720:53: error: loop variable 'gid_klass_pair' is always a copy because the range of type 'hb_map_iter_t, (lambda at ./hb-ot-layout-common.hh:1672:29), hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis] for (const hb_pair_t& gid_klass_pair : + it) And ./hb-ot-color-colr-table.hh:177:44: error: loop variable '_' is always a copy because the range of type 'hb_map_iter_t, (lambda at ./hb-ot-color-colr-table.hh:209:31), hb_function_sortedness_t::RETAINS_SORTING, nullptr>, (anonymous struct at ./hb-algs.hh:331:1) &, (anonymous struct at ./hb-algs.hh:51:1) &, nullptr>, (anonymous struct at ./hb-algs.hh:338:1) &, hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis] for (const hb_item_type& _ : + base_it.iter ()) --- src/hb-ot-color-colr-table.hh | 2 +- src/hb-ot-layout-common.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index 82eab9633..92a49bb4f 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -174,7 +174,7 @@ struct COLR baseGlyphsZ = COLR::min_size; layersZ = COLR::min_size + numBaseGlyphs * BaseGlyphRecord::min_size; - for (const hb_item_type& _ : + base_it.iter ()) + for (const hb_item_type _ : + base_it.iter ()) { auto* record = c->embed (_); if (unlikely (!record)) return_trace (false); diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 30571fb80..6ca69085f 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -1717,7 +1717,7 @@ struct ClassDefFormat1 startGlyph = glyph_min; if (unlikely (!classValue.serialize (c, glyph_count))) return_trace (false); - for (const hb_pair_t& gid_klass_pair : + it) + for (const hb_pair_t gid_klass_pair : + it) { unsigned idx = gid_klass_pair.first - glyph_min; classValue[idx] = gid_klass_pair.second;