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 753119 - %Id is not portable and possible use of uninitialized variable caught by clang
%Id is not portable and possible use of uninitialized variable caught by clang
Status: RESOLVED FIXED
Product: gnome-todo
Classification: Other
Component: General
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: GNOME To Do maintainer(s)
GNOME To Do maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-08-01 03:15 UTC by Ting-Wei Lan
Modified: 2015-08-10 21:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Fix -Werror build for clang (1.48 KB, patch)
2015-08-10 07:39 UTC, Ting-Wei Lan
rejected Details | Review

Description Ting-Wei Lan 2015-08-01 03:15:07 UTC
These problems are found by clang with -Werror enabled.

In src/gtd-application.c, %Id is used in printf format string, but it is a glibc extension and it may be unsupported on other systems.

In src/gtd-task.c, clang finds a possible use of uninitialized variable.

gtd-task.c:638:16: error: variable 'idt' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
      else if (!dt)
               ^~~
gtd-task.c:646:23: note: uninitialized use occurs here
      comp_dt.value = idt;
                      ^~~
gtd-task.c:638:12: note: remove the 'if' if its condition is always true
      else if (!dt)
           ^~~~~~~~
gtd-task.c:606:24: note: initialize the variable 'idt' to silence this warning
      icaltimetype *idt;
                       ^
                        = NULL
1 error generated.
Comment 1 Ting-Wei Lan 2015-08-10 07:39:10 UTC
Created attachment 308999 [details] [review]
build: Fix -Werror build for clang

I don't know whether this fix is correct, but this patch at least allow us to
build gnome-todo with clang -Werror.
Comment 2 Georges Basile Stavracas Neto 2015-08-10 15:05:27 UTC
I don't feel comfortable adding these conditional checks. I'd better use standards everywhere, instead of relying on compiler extensions.