summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-08 12:55:19 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-08 12:55:19 -0300
commit343b88a735001de28bbe6eee9c1549c284bf6d09 (patch)
treea3b256ad8f3cb8062e7ec04b9fc56b901fd8f819 /src/lib/eolian_cxx
parentf683efd2c1082743c667e8b500b857cc852250be (diff)
eolian-cxx: Fix some C++ quirks that makes clang warn about
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/class_definition.hpp12
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp8
-rw-r--r--src/lib/eolian_cxx/grammar/parameter.hpp2
-rw-r--r--src/lib/eolian_cxx/grammar/qualifier_def.hpp4
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp14
5 files changed, 16 insertions, 24 deletions
diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp
index b5ec2a9318..cbf45ad92a 100644
--- a/src/lib/eolian_cxx/grammar/class_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/class_definition.hpp
@@ -110,18 +110,6 @@ struct class_definition_generator
110 scope_tab << "Eo* _eo_ptr() const { return *(Eo**)this; }\n" 110 scope_tab << "Eo* _eo_ptr() const { return *(Eo**)this; }\n"
111 ).generate(sink, attributes::unused, context)) return false; 111 ).generate(sink, attributes::unused, context)) return false;
112 112
113 // operator ::ns::Class_Name() const;
114 // operator ::ns::Class_Name&();
115 // operator ::ns::Class_Name const&() const;
116 if(!as_generator
117 (
118 scope_tab << "operator " << *("::" << lower_case[string]) << "::" << string << "() const;\n"
119 << scope_tab << "operator " << *("::" << lower_case[string]) << "::" << string << "&();\n"
120 << scope_tab << "operator " << *("::" << lower_case[string]) << "::" << string << " const&() const;\n"
121 ).generate(sink, std::make_tuple(cpp_namespaces, cls.cxx_name, cpp_namespaces, cls.cxx_name
122 , cpp_namespaces, cls.cxx_name), context))
123 return false;
124
125 if(!as_generator 113 if(!as_generator
126 ( 114 (
127 *attribute_reorder<1, 2, 0, 1> 115 *attribute_reorder<1, 2, 0, 1>
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index e9c988f795..8a40dbdbe5 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -279,11 +279,11 @@ inline void type_def::set(Eolian_Type const* eolian_type)
279 case EOLIAN_TYPE_POINTER: 279 case EOLIAN_TYPE_POINTER:
280 { 280 {
281 std::vector<pointer_indirection> pointers 281 std::vector<pointer_indirection> pointers
282 {{ {qualifiers(eolian_type)}, false }}; 282 {{ {qualifiers(eolian_type), {}}, false }};
283 Eolian_Type const* base_type = eolian_type_base_type_get(eolian_type); 283 Eolian_Type const* base_type = eolian_type_base_type_get(eolian_type);
284 while(eolian_type_type_get(base_type) == EOLIAN_TYPE_POINTER) 284 while(eolian_type_type_get(base_type) == EOLIAN_TYPE_POINTER)
285 { 285 {
286 pointers.push_back({qualifiers(base_type)}); 286 pointers.push_back({{qualifiers(base_type), {}}});
287 base_type = eolian_type_base_type_get(base_type); 287 base_type = eolian_type_base_type_get(base_type);
288 } 288 }
289 289
@@ -295,7 +295,7 @@ inline void type_def::set(Eolian_Type const* eolian_type)
295 case EOLIAN_TYPE_CLASS: 295 case EOLIAN_TYPE_CLASS:
296 { 296 {
297 Eolian_Class const* klass = eolian_type_class_get(eolian_type); 297 Eolian_Class const* klass = eolian_type_class_get(eolian_type);
298 original_type = klass_name(klass, {qualifiers(eolian_type)}, {}); 298 original_type = klass_name(klass, {qualifiers(eolian_type), {}}, {});
299 } 299 }
300 break; 300 break;
301 case EOLIAN_TYPE_COMPLEX: 301 case EOLIAN_TYPE_COMPLEX:
@@ -636,7 +636,7 @@ struct klass_def
636 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 636 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
637 { 637 {
638 Eolian_Class const* inherit = ::eolian_class_get_by_name(&*inherit_iterator); 638 Eolian_Class const* inherit = ::eolian_class_get_by_name(&*inherit_iterator);
639 inherits.insert({inherit, {qualifier_info::is_none}, {}}); 639 inherits.insert({inherit, {}, {}});
640 inherit_algo(inherit); 640 inherit_algo(inherit);
641 } 641 }
642 }; 642 };
diff --git a/src/lib/eolian_cxx/grammar/parameter.hpp b/src/lib/eolian_cxx/grammar/parameter.hpp
index c1fb1bcff1..f236841707 100644
--- a/src/lib/eolian_cxx/grammar/parameter.hpp
+++ b/src/lib/eolian_cxx/grammar/parameter.hpp
@@ -13,7 +13,7 @@ struct add_reference_visitor
13 template <typename T> 13 template <typename T>
14 void operator()(T& object) const 14 void operator()(T& object) const
15 { 15 {
16 object.pointers.insert(object.pointers.begin(), {{attributes::qualifier_info::is_none}, true}); 16 object.pointers.insert(object.pointers.begin(), {{}, true});
17 } 17 }
18 void operator()(attributes::complex_type_def& complex) const 18 void operator()(attributes::complex_type_def& complex) const
19 { 19 {
diff --git a/src/lib/eolian_cxx/grammar/qualifier_def.hpp b/src/lib/eolian_cxx/grammar/qualifier_def.hpp
index 0f5de4a17d..3ba1a89553 100644
--- a/src/lib/eolian_cxx/grammar/qualifier_def.hpp
+++ b/src/lib/eolian_cxx/grammar/qualifier_def.hpp
@@ -78,6 +78,10 @@ struct qualifier_def
78{ 78{
79 qualifier_info qualifier; 79 qualifier_info qualifier;
80 std::string free_function; 80 std::string free_function;
81
82 qualifier_def() : qualifier(qualifier_info::is_none) {}
83 qualifier_def(qualifier_info info, std::string free_function)
84 : qualifier(info), free_function(std::move(free_function)) {}
81}; 85};
82 86
83inline bool operator<(qualifier_def const& lhs, qualifier_def const& rhs) 87inline bool operator<(qualifier_def const& lhs, qualifier_def const& rhs)
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index a1013ef5a7..7eda7ad47d 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -105,12 +105,12 @@ struct visitor_generate
105 } 105 }
106 const match_table[] = 106 const match_table[] =
107 { 107 {
108 "void_ptr", nullptr, [&] 108 {"void_ptr", nullptr, [&]
109 { 109 {
110 std::vector<attributes::pointer_indirection> pointers = regular.pointers; 110 std::vector<attributes::pointer_indirection> pointers = regular.pointers;
111 pointers.insert(pointers.begin(), {{attributes::qualifier_info::is_none, {}}, false}); 111 pointers.insert(pointers.begin(), {{}, false});
112 return attributes::regular_type_def{"void", regular.base_qualifier, pointers, {}}; 112 return attributes::regular_type_def{"void", regular.base_qualifier, pointers, {}};
113 } 113 }}
114 // signed primitives 114 // signed primitives
115 , {"byte", nullptr, [&] { return replace_base_type(regular, " char"); }} 115 , {"byte", nullptr, [&] { return replace_base_type(regular, " char"); }}
116 , {"llong", nullptr, [&] { return replace_base_type(regular, " long long"); }} 116 , {"llong", nullptr, [&] { return replace_base_type(regular, " long long"); }}
@@ -166,7 +166,7 @@ struct visitor_generate
166 if(regular.pointers.empty() || (regular.pointers.size() == 1 && regular.pointers[0].reference == true)) 166 if(regular.pointers.empty() || (regular.pointers.size() == 1 && regular.pointers[0].reference == true))
167 { 167 {
168 attributes::complex_type_def def 168 attributes::complex_type_def def
169 {attributes::regular_type_def{" ::efl::eina::optional", attributes::qualifier_info::is_none, {}}}; 169 {attributes::regular_type_def{" ::efl::eina::optional", {}}};
170 attributes::regular_type_def no_optional_regular = regular; 170 attributes::regular_type_def no_optional_regular = regular;
171 attributes::remove_optional(no_optional_regular.base_qualifier); 171 attributes::remove_optional(no_optional_regular.base_qualifier);
172 172