From: Lauro Moura Date: Mon, 16 Sep 2019 16:41:37 +0000 (-0400) Subject: cxx: Fix some warnings from -Wextra X-Git-Tag: submit/tizen/20190917.040942~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=424be73fab9003e89a2159fd05b9102e99cb11e5;p=platform%2Fupstream%2Fefl.git cxx: Fix some warnings from -Wextra Summary: - As we don't have C++17's [[fallthrough]], rely on GCC'd detection of fallthrough comments. See https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/ - Add some missing copy assignment operators as reported by -Wdeprecated-copy - Cast a Eina_Bool/bool narrowing conversion Reviewers: zmike, brunobelo, felipealmeida Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9934 --- diff --git a/src/bindings/cxx/eina_cxx/eina_inlist.hh b/src/bindings/cxx/eina_cxx/eina_inlist.hh index 0092989..9eddd9b 100644 --- a/src/bindings/cxx/eina_cxx/eina_inlist.hh +++ b/src/bindings/cxx/eina_cxx/eina_inlist.hh @@ -108,6 +108,21 @@ struct _inlist_iterator : _list(other._list), _node(other._node) {} /** + * @brief Copy assignment operator. + * @param other Other iterator being copied + * @return Copy of the iterator + */ + _inlist_iterator & operator=(_inlist_iterator::type> const& other) + { + if (this != &other) + { + _list = other._list; + _node = other._node; + } + return *this; + } + + /** * @brief Move the iterator to the next position in the list. * @return The iterator itself. * diff --git a/src/bindings/cxx/eina_cxx/eina_ptrarray.hh b/src/bindings/cxx/eina_cxx/eina_ptrarray.hh index b5de9d7..e140544 100644 --- a/src/bindings/cxx/eina_cxx/eina_ptrarray.hh +++ b/src/bindings/cxx/eina_cxx/eina_ptrarray.hh @@ -50,6 +50,12 @@ struct _ptr_array_iterator : _ptr(other._ptr) { } + _ptr_array_iterator& operator=(_ptr_array_iterator::type> const& other) + { + if (this != &other) + _ptr = other._ptr; + return *this; + } _ptr_array_iterator& operator++() { ++_ptr; diff --git a/src/bindings/cxx/eina_cxx/eina_ptrlist.hh b/src/bindings/cxx/eina_cxx/eina_ptrlist.hh index 03b836a..12f7f7e 100644 --- a/src/bindings/cxx/eina_cxx/eina_ptrlist.hh +++ b/src/bindings/cxx/eina_cxx/eina_ptrlist.hh @@ -67,6 +67,13 @@ struct _ptr_list_iterator : _ptr_list_iterator_base { } + _ptr_list_iterator& operator=(_ptr_list_iterator const &other) + { + if (this != &other) + _ptr_list_iterator_base::operator=(other); + return *this; + } + _ptr_list_iterator& operator++() { _node = eina_list_next(_node); diff --git a/src/lib/eolian_cxx/grammar/html_escaped_string.hpp b/src/lib/eolian_cxx/grammar/html_escaped_string.hpp index 371afcd..5bbad79 100644 --- a/src/lib/eolian_cxx/grammar/html_escaped_string.hpp +++ b/src/lib/eolian_cxx/grammar/html_escaped_string.hpp @@ -26,7 +26,8 @@ struct html_escaped_string_generator case '\'': out.append("'"); break; case '<': out.append("<"); break; case '>': out.append(">"); break; - case '\\': if (pos < input.size() - 1) pos++; // Deliberate fallthrough + case '\\': if (pos < input.size() - 1) pos++; + // fall through default: out.append(&input[pos], 1); break; } } diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index a3f3f3d..609df6e 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -492,7 +492,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni complex.subtypes.push_back({stp , unit , ::eolian_type_c_type_get(stp) - , eolian_type_is_move(stp) + , (bool)eolian_type_is_move(stp) , is_by::value}); stp = eolian_type_next_type_get(stp); }