path: root/src/bindings/cxx/eldbus_cxx/eldbus_service.hh
diff options
authorVitor Sousa <>2019-07-12 09:07:27 -0400
committerMike Blumenkrantz <>2019-07-12 09:07:27 -0400
commitb1e44484a5702c840d8ab8db1b09121c1d43b126 (patch)
treeb96209f4af51649953b2b1eb3824af0dba0e136a /src/bindings/cxx/eldbus_cxx/eldbus_service.hh
parentc001a8146bcc366780cd50fa51e8f91cfd2b1d5c (diff)
cxx: remove compilation warnings in C++ code, from both gcc and clang
Summary: Remove almost all the compilation warnings from C++ code. Only explicit warnings using the `#warning` preprocessor directive remain. Some warnings had to be suppressed with `#pragma` directives because the behavior they were warning about is intended in some specific places. Code comments were added in such situations. Added a generator that creates `#pragma` directives in order to suppress warnings in all generated C++ headers. Currently `-Wignored-qualifiers` is the only warning category being suppressed. The innocuous const qualifiers that it points are inoffensive and have no effect in compilation at all. They are also hard to track in generation since they can emerge from different types in many places. To ease the generation of the warning suppressors an utility constructor was added to `efl::eolian::grammar::attributes::unused_type`. Add constructors to `eolian_mono::class_context` to default initialize its internal string and avoid field initialization warnings. Test Plan: `meson test` Reviewers: lauromoura, felipealmeida, zmike, segfaultxavi Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl_language_bindings Differential Revision:
Diffstat (limited to '')
1 files changed, 16 insertions, 4 deletions
diff --git a/src/bindings/cxx/eldbus_cxx/eldbus_service.hh b/src/bindings/cxx/eldbus_cxx/eldbus_service.hh
index 6a4919c..31c3386 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
293 293
294 eldbus::_fill_methods(*out_params, method.outs); 294 eldbus::_fill_methods(*out_params, method.outs);
295 295
296 // NOTE: C pointer magic performed under the hood requires this conversion
297 // between incompatible function pointer types.
298 // C++ always raises a warning for such conversions, so this warning
299 // can be disabled just here.
300#pragma GCC diagnostic push
301#ifndef __clang__
302#pragma GCC diagnostic ignored "-Wcast-function-type"
304 Eldbus_Method_Cb method_cb =
305 reinterpret_cast<Eldbus_Method_Cb>
306 (static_cast<Eldbus_Method_Data_Cb>
307 (&_method_callback<typename Method::function_type
308 , typename Method::ins_type, typename Method::outs_type>));
309#pragma GCC diagnostic pop
296 eldbus_method = {{, &(*in_params)[0], &(*out_params)[0] 311 eldbus_method = {{, &(*in_params)[0], &(*out_params)[0]
297 , reinterpret_cast<Eldbus_Method_Cb> 312 , method_cb
298 (static_cast<Eldbus_Method_Data_Cb>
299 (&_method_callback<typename Method::function_type
300 , typename Method::ins_type, typename Method::outs_type>))
302 , new std::tuple<typename Method::function_type 314 , new std::tuple<typename Method::function_type
303 , typename Method::ins_type, typename Method::outs_type 315 , typename Method::ins_type, typename Method::outs_type