summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-09-23 13:33:52 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-09-23 13:58:01 -0300
commit03da60997e76d1604b4554e60866283591b98e0d (patch)
tree7f59041944bdf288f9e4d3bf4fed2d7ee9446b82 /src
parent883ef612b771d44c6170f05655de723fa3a2e9e5 (diff)
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/ - Replaced some copy constructors with typecast operators. Previously, a constructor with remove_const/remove_cv were used to allow const iterators to be constructed from non-const iterators. This had the side effect of making these constructors actual copy constructors for non const lists. As we did not define other special constructors/operators, the rule of 5 were violated for these cases. This commit replaces these constructors with actual typecast operators that promote non const iterators to their const counterparts. - Cast a Eina_Bool/bool narrowing conversion - Add a missing break statement from D10050 Reviewers: zmike, brunobelo, felipealmeida Reviewed By: brunobelo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9934
Diffstat (limited to '')
-rw-r--r--src/bindings/cxx/eina_cxx/eina_inlist.hh7
-rw-r--r--src/bindings/cxx/eina_cxx/eina_ptrarray.hh4
-rw-r--r--src/bindings/cxx/eina_cxx/eina_ptrlist.hh4
-rw-r--r--src/lib/eolian_cxx/grammar/html_escaped_string.hpp3
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp3
5 files changed, 12 insertions, 9 deletions
diff --git a/src/bindings/cxx/eina_cxx/eina_inlist.hh b/src/bindings/cxx/eina_cxx/eina_inlist.hh
index 0092989cb7..8804034d11 100644
--- a/src/bindings/cxx/eina_cxx/eina_inlist.hh
+++ b/src/bindings/cxx/eina_cxx/eina_inlist.hh
@@ -101,11 +101,12 @@ struct _inlist_iterator
101 : _list(list), _node(node) {} 101 : _list(list), _node(node) {}
102 102
103 /** 103 /**
104 * @brief Copy constructor. Creates a copy of the given iterator. 104 * @brief Create a const iterator from this one.
105 * @param other Other iterator. 105 * @param other Other iterator.
106 */ 106 */
107 _inlist_iterator(_inlist_iterator<typename std::remove_const<T>::type> const& other) 107 operator _inlist_iterator<T const>() {
108 : _list(other._list), _node(other._node) {} 108 return _inlist_iterator<T const>{_list, _node};
109 }
109 110
110 /** 111 /**
111 * @brief Move the iterator to the next position in the list. 112 * @brief Move the iterator to the next position in the list.
diff --git a/src/bindings/cxx/eina_cxx/eina_ptrarray.hh b/src/bindings/cxx/eina_cxx/eina_ptrarray.hh
index b5de9d7290..b2f6ef515b 100644
--- a/src/bindings/cxx/eina_cxx/eina_ptrarray.hh
+++ b/src/bindings/cxx/eina_cxx/eina_ptrarray.hh
@@ -46,9 +46,9 @@ struct _ptr_array_iterator
46 46
47 { 47 {
48 } 48 }
49 _ptr_array_iterator(_ptr_array_iterator<typename remove_cv<value_type>::type> const& other) 49 operator _ptr_array_iterator<T const>()
50 : _ptr(other._ptr)
51 { 50 {
51 return _ptr_array_iterator<T const>{_ptr};
52 } 52 }
53 _ptr_array_iterator<T>& operator++() 53 _ptr_array_iterator<T>& operator++()
54 { 54 {
diff --git a/src/bindings/cxx/eina_cxx/eina_ptrlist.hh b/src/bindings/cxx/eina_cxx/eina_ptrlist.hh
index 03b836ab6f..988658b2fa 100644
--- a/src/bindings/cxx/eina_cxx/eina_ptrlist.hh
+++ b/src/bindings/cxx/eina_cxx/eina_ptrlist.hh
@@ -62,9 +62,9 @@ struct _ptr_list_iterator : _ptr_list_iterator_base
62 : _ptr_list_iterator_base(list, node) 62 : _ptr_list_iterator_base(list, node)
63 { 63 {
64 } 64 }
65 _ptr_list_iterator(_ptr_list_iterator<value_type> const& other) 65 operator _ptr_list_iterator<T const>()
66 : _ptr_list_iterator_base(static_cast<_ptr_list_iterator_base const&>(other))
67 { 66 {
67 return _ptr_list_iterator<T const>{_list, _node};
68 } 68 }
69 69
70 _ptr_list_iterator<T>& operator++() 70 _ptr_list_iterator<T>& operator++()
diff --git a/src/lib/eolian_cxx/grammar/html_escaped_string.hpp b/src/lib/eolian_cxx/grammar/html_escaped_string.hpp
index 371afcda24..5bbad79c0f 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
26 case '\'': out.append("&apos;"); break; 26 case '\'': out.append("&apos;"); break;
27 case '<': out.append("&lt;"); break; 27 case '<': out.append("&lt;"); break;
28 case '>': out.append("&gt;"); break; 28 case '>': out.append("&gt;"); break;
29 case '\\': if (pos < input.size() - 1) pos++; // Deliberate fallthrough 29 case '\\': if (pos < input.size() - 1) pos++;
30 // fall through
30 default: out.append(&input[pos], 1); break; 31 default: out.append(&input[pos], 1); break;
31 } 32 }
32 } 33 }
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index b1f6c383a3..a7a01cc243 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -495,7 +495,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
495 complex.subtypes.push_back({stp 495 complex.subtypes.push_back({stp
496 , unit 496 , unit
497 , ::eolian_type_c_type_get(stp) 497 , ::eolian_type_c_type_get(stp)
498 , eolian_type_is_move(stp) 498 , static_cast<bool>(eolian_type_is_move(stp))
499 , is_by::value}); 499 , is_by::value});
500 stp = eolian_type_next_type_get(stp); 500 stp = eolian_type_next_type_get(stp);
501 } 501 }
@@ -532,6 +532,7 @@ inline void type_def::set(Eolian_Expression_Type eolian_exp_type)
532 break; 532 break;
533 case EOLIAN_EXPR_STRING: 533 case EOLIAN_EXPR_STRING:
534 set("string", "const char *"); 534 set("string", "const char *");
535 break;
535 case EOLIAN_EXPR_BOOL: 536 case EOLIAN_EXPR_BOOL:
536 set("bool", "Eina_Bool"); 537 set("bool", "Eina_Bool");
537 break; 538 break;