After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725994 - cheese uses -Werror=nonliteral-format and non-literal format strings
cheese uses -Werror=nonliteral-format and non-literal format strings
Status: RESOLVED FIXED
Product: cheese
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Cheese Maintainer(s)
Cheese Maintainer(s)
Depends on: 726057
Blocks:
 
 
Reported: 2014-03-09 18:59 UTC by Allison Karlitskaya (desrt)
Modified: 2014-03-17 21:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use g_application_add_main_option_entries() (6.11 KB, patch)
2014-03-10 23:06 UTC, David King
needs-work Details | Review

Description Allison Karlitskaya (desrt) 2014-03-09 18:59:19 UTC
Cheese (due to its use of Vala) makes use of non-literal format strings.

One such example:

  _tmp13_ = stdout;
  _tmp14_ = _ ("Run '%s --help' to see a full list of available command line options.");
  _tmp15_ = arguments;
  _tmp15__length1 = arguments_length1;
  _tmp16_ = _tmp15_[0];
  fprintf (_tmp13_, _tmp14_, _tmp16_);

it should probably stop using -Werror=non-literal format (and maybe a lot of other warnings CFLAGS) if it's using Vala...

gcc makes an exception to the non-literal format string rule in cases of functions that take va_list instead of '...', but clang makes no such exception -- instead, it forces the format-string annotation to be applied at the next level up, so cheese currently won't build with clang and default CFLAGS.

as an aside: for this particular case, maybe it makes sense to look at the new GApplication commandline argument handling API, which would eliminate the need to throw this message yourself...
Comment 1 Allison Karlitskaya (desrt) 2014-03-09 19:02:07 UTC
(vala bug 725995)
Comment 2 David King 2014-03-10 23:06:54 UTC
Created attachment 271489 [details] [review]
use g_application_add_main_option_entries()

The attached patch works for me, and I guess avoids the string format warning as a side effect. I am not a Vala expert, so I still need to fix the TODO if I can (but will look at it again tomorrow). Please let me know if it works with clang.
Comment 3 David King 2014-03-10 23:09:14 UTC
I should have mentioned that bug 726057 needs fixing for ApplicationCommandLine.get_options_dict() to appear in the VAPI.
Comment 4 Allison Karlitskaya (desrt) 2014-03-11 01:19:54 UTC
Review of attachment 271489 [details] [review]:

::: src/cheese-application.vala
@@ +157,3 @@
+        var opts = cl.get_options_dict ();
+
+        if (opts.contains ("device"))

You want type string "^ay" to read into a char*.

But in general, you should not be using command_line in this way... that comes down to the Vala bindings being updated, as you properly point out.
Comment 5 David King 2014-03-17 21:41:28 UTC
Fixed in master with commit 9697f05e2c0ce03b96791ec2fa9b993c4c505164. Thanks for the hint about the "^ay".