diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh index d5d57c4498..ef4f5f4dbd 100644 --- a/src/bin/eolian_mono/eolian/mono/events.hh +++ b/src/bin/eolian_mono/eolian/mono/events.hh @@ -1,5 +1,5 @@ #ifndef EOLIAN_MONO_EVENTS_HH -#define EOLINA_MONO_EVENTS_HH +#define EOLIAN_MONO_EVENTS_HH #include diff --git a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh index dc72696342..985e3739d9 100644 --- a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh +++ b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh @@ -21,6 +21,16 @@ struct class_context }; wrapper_kind current_wrapper_kind; std::string name; + + class_context(wrapper_kind current_wrapper_kind) + : current_wrapper_kind(current_wrapper_kind) + , name() + {} + + class_context(wrapper_kind current_wrapper_kind, std::string const& name) + : current_wrapper_kind(current_wrapper_kind) + , name(name) + {} }; struct indentation_context diff --git a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh index d3fcbfa41e..ce16c9a374 100644 --- a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh +++ b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh @@ -183,6 +183,7 @@ struct marshall_type_visitor_generate , is_out , is_return , is_ptr + , false , is_special_subtype }(r); } @@ -195,6 +196,7 @@ struct marshall_type_visitor_generate , is_out , is_return , is_ptr + , false , is_special_subtype }(regular); } @@ -208,6 +210,7 @@ struct marshall_type_visitor_generate , is_out , is_return , is_ptr + , false , is_special_subtype }(klass_name); } @@ -253,7 +256,7 @@ struct marshall_type_visitor_generate auto default_match = [&] (attributes::complex_type_def const& complex) { regular_type_def no_pointer_regular = complex.outer; - return visitor_type{sink, context, c_type, false}(no_pointer_regular) + return visitor_type{sink, context, c_type, false, false, false, false}(no_pointer_regular) && as_generator("<" << (type(false, false, true) % ", ") << ">").generate(sink, complex.subtypes, *context); }; @@ -286,6 +289,7 @@ struct marshall_type_visitor_generate , is_out , is_return , is_ptr + , false , is_special_subtype }(complex); } diff --git a/src/bin/eolian_mono/eolian/mono/type_impl.hh b/src/bin/eolian_mono/eolian/mono/type_impl.hh index 41cdf92f19..abfa6e9db6 100644 --- a/src/bin/eolian_mono/eolian/mono/type_impl.hh +++ b/src/bin/eolian_mono/eolian/mono/type_impl.hh @@ -412,7 +412,7 @@ struct visitor_generate // pointers.swap(no_pointer_regular.pointers); // if(is_out) // pointers.push_back({{attributes::qualifier_info::is_none, {}}, true}); - return visitor_type{sink, context, c_type, false}(no_pointer_regular) + return visitor_type{sink, context, c_type, false, false, false, false, false}(no_pointer_regular) && as_generator("<" << (type(false, false, true) % ", ") << ">").generate(sink, complex.subtypes, *context) ; // && detail::generate_pointers(sink, pointers, *context, false); diff --git a/src/bindings/cxx/eina_cxx/eina_optional.hh b/src/bindings/cxx/eina_cxx/eina_optional.hh index 91b38c3290..70a5cc20e5 100644 --- a/src/bindings/cxx/eina_cxx/eina_optional.hh +++ b/src/bindings/cxx/eina_cxx/eina_optional.hh @@ -387,7 +387,15 @@ private: void _construct(U&& object) { assert(!is_engaged()); + // NOTE: the buffer memory is intended to be in an + // uninitialized state here. + // So this warning can be disabled. +#pragma GCC diagnostic push +#ifndef __clang__ +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif new (&buffer) T(std::forward(object)); +#pragma GCC diagnostic pop engaged = true; } diff --git a/src/bindings/cxx/eldbus_cxx/eldbus_service.hh b/src/bindings/cxx/eldbus_cxx/eldbus_service.hh index 6a4919ccb8..31c3386bd3 100644 --- a/src/bindings/cxx/eldbus_cxx/eldbus_service.hh +++ b/src/bindings/cxx/eldbus_cxx/eldbus_service.hh @@ -293,11 +293,23 @@ void _create_methods_specification_impl(Method const& method, Eldbus_Method2& el eldbus::_fill_methods(*out_params, method.outs); + // NOTE: C pointer magic performed under the hood requires this conversion + // between incompatible function pointer types. + // C++ always raises a warning for such conversions, so this warning + // can be disabled just here. +#pragma GCC diagnostic push +#ifndef __clang__ +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + Eldbus_Method_Cb method_cb = + reinterpret_cast + (static_cast + (&_method_callback)); +#pragma GCC diagnostic pop + eldbus_method = {{method.name, &(*in_params)[0], &(*out_params)[0] - , reinterpret_cast - (static_cast - (&_method_callback)) + , method_cb , ELDBUS_METHOD_FLAG_HAS_DATA} , new std::tuple diff --git a/src/lib/eolian_cxx/grammar/class_implementation.hpp b/src/lib/eolian_cxx/grammar/class_implementation.hpp index 615ee6022e..74283352e7 100644 --- a/src/lib/eolian_cxx/grammar/class_implementation.hpp +++ b/src/lib/eolian_cxx/grammar/class_implementation.hpp @@ -15,6 +15,7 @@ #include "grammar/type_impl.hpp" #include "grammar/attribute_reorder.hpp" #include "grammar/part_implementation.hpp" +#include "grammar/ignore_warning.hpp" namespace efl { namespace eolian { namespace grammar { @@ -42,6 +43,9 @@ struct class_implementation_generator .generate(sink, std::make_tuple(cls.namespaces, cls.cxx_name), add_lower_case_context(ctx))) return false; + if(!as_generator(ignore_warning_begin).generate(sink, nullptr, ctx)) + return false; + #ifndef USE_EOCXX_INHERIT_ONLY if(!as_generator( (namespaces @@ -71,6 +75,9 @@ struct class_implementation_generator )).generate(sink, std::make_tuple(cls.namespaces, cls.functions, cpp_namespaces, cls.cxx_name, cls.parts), ctx)) return false; + if(!as_generator(ignore_warning_end).generate(sink, nullptr, ctx)) + return false; + if(!as_generator("#endif\n").generate(sink, std::make_tuple(), ctx)) return false; diff --git a/src/lib/eolian_cxx/grammar/generator.hpp b/src/lib/eolian_cxx/grammar/generator.hpp index 6d0be7e4f1..25fff51ff7 100644 --- a/src/lib/eolian_cxx/grammar/generator.hpp +++ b/src/lib/eolian_cxx/grammar/generator.hpp @@ -46,7 +46,7 @@ struct is_eager_generator : is_eager_generator {}; // struct is_generator : is_eager_generator {}; template ::value>::type> -G as_generator(G&& g) { return g; } +G as_generator(G g) { return g; } } } } diff --git a/src/lib/eolian_cxx/grammar/header.hpp b/src/lib/eolian_cxx/grammar/header.hpp index 29435404dd..f749584163 100644 --- a/src/lib/eolian_cxx/grammar/header.hpp +++ b/src/lib/eolian_cxx/grammar/header.hpp @@ -11,6 +11,7 @@ #include "class_definition.hpp" #include "class_declaration.hpp" #include "implementation_include_directive.hpp" +#include "ignore_warning.hpp" namespace efl { namespace eolian { namespace grammar { @@ -27,11 +28,13 @@ auto class_header = << *class_declaration // sequence | class << *class_forward_declaration // sequence | class << string // extra header + << ignore_warning_begin << "\nnamespace eo_cxx {\n" << *base_class_definition // sequence | class << "}\n" << *class_definition // sequence | class // << *implementation_include_directive + << ignore_warning_end ] ; diff --git a/src/lib/eolian_cxx/grammar/ignore_warning.hpp b/src/lib/eolian_cxx/grammar/ignore_warning.hpp new file mode 100644 index 0000000000..d3d2a6e3d1 --- /dev/null +++ b/src/lib/eolian_cxx/grammar/ignore_warning.hpp @@ -0,0 +1,48 @@ +#ifndef EOLIAN_CXX_IGNORE_WARNING_HH +#define EOLIAN_CXX_IGNORE_WARNING_HH + +#include "grammar/generator.hpp" + +namespace efl { namespace eolian { namespace grammar { + +struct ignore_warning_begin_generator +{ + template + bool generate(OutputIterator sink, attributes::unused_type, Context const& context) const + { + return as_generator( + "\n" + "#pragma GCC diagnostic push\n" + "#pragma GCC diagnostic ignored \"-Wignored-qualifiers\"\n" + "\n" + ).generate(sink, nullptr, context); + } +}; + +struct ignore_warning_end_generator +{ + template + bool generate(OutputIterator sink, attributes::unused_type, Context const& context) const + { + return as_generator( + "\n#pragma GCC diagnostic pop\n\n" + ).generate(sink, nullptr, context); + } +}; + +template <> +struct is_eager_generator : std::true_type {}; +template <> +struct is_generator : std::true_type {}; + +template <> +struct is_eager_generator : std::true_type {}; +template <> +struct is_generator : std::true_type {}; + +ignore_warning_begin_generator constexpr ignore_warning_begin = {}; +ignore_warning_end_generator constexpr ignore_warning_end = {}; + +} } } + +#endif diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp index ca73a14bd0..c5bd4d8363 100644 --- a/src/lib/eolian_cxx/grammar/type_impl.hpp +++ b/src/lib/eolian_cxx/grammar/type_impl.hpp @@ -348,7 +348,7 @@ struct visitor_generate // pointers.swap(no_pointer_regular.pointers); // if(is_out) // pointers.push_back({{attributes::qualifier_info::is_none, {}}, true}); - return visitor_type{sink, context, c_type, false}(no_pointer_regular) + return visitor_type{sink, context, c_type, false, false}(no_pointer_regular) && as_generator("<" << (type % ", ") << ">").generate(sink, complex.subtypes, *context) ; // && detail::generate_pointers(sink, pointers, *context, false); diff --git a/src/lib/ephysics/ephysics_quaternion.cpp b/src/lib/ephysics/ephysics_quaternion.cpp index 899204d563..bf1b91548e 100644 --- a/src/lib/ephysics/ephysics_quaternion.cpp +++ b/src/lib/ephysics/ephysics_quaternion.cpp @@ -126,7 +126,6 @@ ephysics_quaternion_euler_set(EPhysics_Quaternion *quat, double yaw, double pitc return; } - bt_quat = btQuaternion(); bt_quat.setEuler(yaw / RAD_TO_DEG, pitch / RAD_TO_DEG, roll / RAD_TO_DEG); _ephysics_quaternion_update(quat, &bt_quat); } diff --git a/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc b/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc index 5ad5da5015..749b8b0fda 100644 --- a/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc +++ b/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc @@ -14,7 +14,7 @@ void call_async(efl::eina::mutex& mutex, efl::eina::condition_variable& cond, in { efl::ecore::main_loop_thread_safe_call_async ( - [&mutex,&cond,&done] + [&mutex,&done] { std::cout << "yeah" << std::endl; efl::eina::unique_lock l(mutex); diff --git a/src/tests/eina_cxx/eina_cxx_test_optional.cc b/src/tests/eina_cxx/eina_cxx_test_optional.cc index 381198c288..5eb2631451 100644 --- a/src/tests/eina_cxx/eina_cxx_test_optional.cc +++ b/src/tests/eina_cxx/eina_cxx_test_optional.cc @@ -102,7 +102,14 @@ EFL_START_TEST(eina_cxx_optional_assignment) assert(!a); assert(b); assert(c); assert(d); + // NOTE: resistance to self assignment is exactly what is being tested here, + // so this compilation warning can be suppressed. +#pragma GCC diagnostic push +#ifdef __clang__ +#pragma GCC diagnostic ignored "-Wself-assign-overloaded" +#endif a = a; +#pragma GCC diagnostic pop ck_assert(a == a); ck_assert(!a); diff --git a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc index be6b16395d..12c375a112 100644 --- a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc +++ b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc @@ -385,7 +385,7 @@ EFL_START_TEST(eina_cxx_ptrlist_constructors) efl::eina::list list2(10, w1); ck_assert(list2.size() == 10); ck_assert(std::find_if(list2.begin(), list2.end() - , [&list2, w2] (wrapper i) + , [w2] (wrapper i) { return i == w2; }