From: Jean-Philippe Andre Date: Wed, 22 Nov 2017 11:50:11 +0000 (+0900) Subject: cxx: Avoid pedantic warning with -Wold-style-cast X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1363 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4e3d4d8a4f1e0712dbbd309bf4b2f11e36acef1;p=platform%2Fupstream%2Fefl.git cxx: Avoid pedantic warning with -Wold-style-cast This affects the generated headers. --- diff --git a/src/lib/eolian_cxx/grammar/base_class_definition.hpp b/src/lib/eolian_cxx/grammar/base_class_definition.hpp index aa61334..d5fa914 100644 --- a/src/lib/eolian_cxx/grammar/base_class_definition.hpp +++ b/src/lib/eolian_cxx/grammar/base_class_definition.hpp @@ -64,10 +64,11 @@ struct base_class_definition_generator return false; if(!as_generator(";\n" << scope_tab << "}\n").generate(sink, attributes::unused, context)) return false; - if(!as_generator - ( - scope_tab << "Eo* _eo_ptr() const { return *(Eo**)this; }\n" - ).generate(sink, attributes::unused, context)) return false; + if(!as_generator( + scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast" + << "(const_cast<" << string << " *>(this))); }\n" + ).generate(sink, cls.cxx_name, context)) + return false; // operator ::ns::Class_Name() const; // operator ::ns::Class_Name&(); diff --git a/src/lib/eolian_cxx/grammar/class_definition.hpp b/src/lib/eolian_cxx/grammar/class_definition.hpp index 1e21336..30a9daf 100644 --- a/src/lib/eolian_cxx/grammar/class_definition.hpp +++ b/src/lib/eolian_cxx/grammar/class_definition.hpp @@ -128,10 +128,11 @@ struct class_definition_generator return false; if(!as_generator(";\n" << scope_tab << "}\n").generate(sink, attributes::unused, context)) return false; - if(!as_generator - ( - scope_tab << "Eo* _eo_ptr() const { return *(Eo**)this; }\n" - ).generate(sink, attributes::unused, context)) return false; + if(!as_generator( + scope_tab << "Eo* _eo_ptr() const { return *(reinterpret_cast" + << "(const_cast<" << string << " *>(this))); }\n" + ).generate(sink, cls.cxx_name, context)) + return false; for (auto&& e : cls.events) {