Pelagicore / gdbus-codegen-glibmm

Code generator for C++ D-Bus stubs and proxies using Giomm/Glibmm
GNU Lesser General Public License v2.1
23 stars 25 forks source link

Silence warnings #51

Closed martin-ejdestig closed 5 years ago

martin-ejdestig commented 5 years ago

I have fiddled around a bunch with trying to get whitespacing right. This was the best I could do. There is still a missing \n in the generated code before the common.pragma_warnings_pop block. Perhaps someone can clue me in on why that is removed.

mardy commented 5 years ago

Thanks Martin! I have only a small objection, about the suppression of warnings for unused parameters: I would prefer if we used something similar to what Qt has:

#define Q_UNUSED(x) (void)x;

The advantage of doing this is that we don't need to complicate the header files, because this is done in the .cpp parts. You can define an UNUSED() macro at the top of the files, or just write

(void)x; // possibly unused

for each variable. Extra points if you are able to add these lines only when necessary, but it might not be so easy, so no need to waste a lot of time on this.

martin-ejdestig commented 5 years ago

The pragmas are not put in the headers. But I will replace them with a cast without a macro (more local).

martin-ejdestig commented 5 years ago

Found another warning (catch by value) when testing properties and added a fix for that as well.

martin-ejdestig commented 5 years ago

Oh, one thing I am wondering about is what the empty:

void {{ class_name_with_namespace }}::{{ prop.name }}_set_finish(const Glib::RefPtr&/ res /) { }

is about. Noticed it was empty when commenting out "res". Should it just be removed? Or why is it there if it is just empty and not abstract? Unsure if it is a mistake or left over to be backwards compatible.

martin-ejdestig commented 5 years ago

So, apparently the proxy object inherits from Glib::ObjectBase but does not wrap a GObject. Updated "templates: fix hiding of overloaded virtual function warnings" commit.