GNOME Bugzilla – Bug 753119
%Id is not portable and possible use of uninitialized variable caught by clang
Last modified: 2015-08-10 21:54:19 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.
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.
I don't feel comfortable adding these conditional checks. I'd better use standards everywhere, instead of relying on compiler extensions.