From 4dc3db7344b464695d3c8cfdb7f3e5d518b4a6ac Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 6 Feb 2020 12:12:41 +0330 Subject: [PATCH] Minor, fix warnings raised when built with -std=c++2a Follow up to c184180, It was raising, src/hb-ot-layout-common.hh:1067:63: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture] | hb_filter ([=] (const OffsetTo &_) { return (this+_).intersects (glyphset, lookup_type); }) ^ src/hb-ot-layout-common.hh:1067:19: note: add an explicit capture of 'this' to capture '*this' by reference | hb_filter ([=] (const OffsetTo &_) { return (this+_).intersects (glyphset, lookup_type); }) ^ , this and src/hb-ot-layout-common.hh:2626:38: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture] { r.collect_lookups (this, lookup_indexes); }) ^ src/hb-ot-layout-common.hh:2625:18: note: add an explicit capture of 'this' to capture '*this' by reference | hb_apply ([=] (const FeatureTableSubstitutionRecord& r) ^ , this and src/hb-ot-hdmx-table.hh:141:44: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture] return device_record->widthsZ.as_array (get_num_glyphs ()) [_]; ^ src/hb-ot-hdmx-table.hh:137:17: note: add an explicit capture of 'this' to capture '*this' by reference | hb_map ([=] (hb_codepoint_t _) ^ , this --- .circleci/config.yml | 4 +++- src/hb-ot-hdmx-table.hh | 4 ++-- src/hb-ot-layout-common.hh | 18 ++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5631bb26f..6ae1abef0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,7 +111,9 @@ jobs: - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh - run: make clean - run: make -Csrc CPPFLAGS="-DHB_TINY -DHB_NO_OT_FONT" libharfbuzz-subset.la && make clean - - run: clang -c src/hb-*.cc -DHB_NO_MT + - run: clang -c src/harfbuzz.cc -DHB_NO_MT + # -Werror -Werror=deprecated-this-capture can be added but it will confuse contributors so let's skip for now + - run: clang -c src/hb-*.cc -DHB_NO_MT -std=c++2a -fno-exceptions gcc-valgrind: docker: diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh index 96c1d1f63..b4d1906a3 100644 --- a/src/hb-ot-hdmx-table.hh +++ b/src/hb-ot-hdmx-table.hh @@ -134,10 +134,10 @@ struct hdmx auto row = + hb_range (c->plan->num_output_glyphs ()) | hb_map (c->plan->reverse_glyph_map) - | hb_map ([=] (hb_codepoint_t _) + | hb_map ([this, c, device_record] (hb_codepoint_t _) { if (c->plan->is_empty_glyph (_)) - return Null(HBUINT8); + return Null (HBUINT8); return device_record->widthsZ.as_array (get_num_glyphs ()) [_]; }) ; diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 8bed148ec..271aaa5b3 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -382,7 +382,7 @@ struct RecordListOfFeature : RecordListOf TRACE_SUBSET (this); auto *out = c->serializer->start_embed (*this); if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false); - + unsigned count = this->len; + hb_zip (*this, hb_range (count)) | hb_filter (l->feature_index_map, hb_second) @@ -497,7 +497,7 @@ struct LangSys for (const auto _ : + hb_zip (featureIndex, o.featureIndex)) if (_.first != _.second) return false; - + return true; } @@ -886,9 +886,9 @@ struct Feature TRACE_SUBSET (this); auto *out = c->serializer->start_embed (*this); if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false); - + out->featureParams = 0; /* TODO(subset) FeatureParams. */ - + auto it = + hb_iter (lookupIndex) | hb_filter (l->lookup_index_map) @@ -1064,7 +1064,7 @@ struct Lookup const hb_set_t *glyphset = c->plan->glyphset (); unsigned int lookup_type = get_type (); + hb_iter (get_subtables ()) - | hb_filter ([=] (const OffsetTo &_) { return (this+_).intersects (glyphset, lookup_type); }) + | hb_filter ([this, glyphset, lookup_type] (const OffsetTo &_) { return (this+_).intersects (glyphset, lookup_type); }) | hb_apply (subset_offset_array (c, out->get_subtables (), this, out, lookup_type)) ; @@ -1129,7 +1129,7 @@ struct LookupOffsetList : OffsetListOf TRACE_SUBSET (this); auto *out = c->serializer->start_embed (this); if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false); - + unsigned count = this->len; + hb_zip (*this, hb_range (count)) | hb_filter (l->lookup_index_map, hb_second) @@ -2622,10 +2622,8 @@ struct FeatureTableSubstitution { + hb_iter (substitutions) | hb_filter (feature_indexes, &FeatureTableSubstitutionRecord::featureIndex) - | hb_apply ([=] (const FeatureTableSubstitutionRecord& r) - { - r.collect_lookups (this, lookup_indexes); - }) + | hb_apply ([this, lookup_indexes] (const FeatureTableSubstitutionRecord& r) + { r.collect_lookups (this, lookup_indexes); }) ; }