flatpak / xdg-desktop-portal-gtk

Gtk implementation of xdg-desktop-portal
GNU Lesser General Public License v2.1
130 stars 102 forks source link

Improve compile warnings #458

Open ebassi opened 1 year ago

ebassi commented 1 year ago

If we can, we should rejig the code to avoid declaring unused arguments and variables; if we can't, we can use G_GNUC_UNUSED to eliminate the warning.

ebassi commented 1 year ago

Actually, the compiler warnings situation is not nice. We're currently using warning_level=2 but:

xdg-desktop-portal-gtk is a security boundary, and we should be more careful with the code we're shipping.

TingPing commented 1 year ago

We're currently using warning_level=2 but we should really use warning_level=3

My personal opinion is -pedantic contains a lot of pointless annoyances and just including specific warnings has better results.

ebassi commented 1 year ago

I agree about pedantic, so even with warning_level=3 I'd drop it with additional compiler warnings; the other option is to add a bunch of warnings ourselves on top of warning_level=2.

TingPing commented 1 year ago

Just to clarify, warning_level=3 only adds -Wpedantic:

https://github.com/mesonbuild/meson/blob/ae7a9b0f4430a055ac419c6f1157cbd0e6eed45c/mesonbuild/compilers/c.py#L155-L158