GNOME Bugzilla – Bug 793592
rtp-server: compilation error with clang
Last modified: 2018-02-19 20:29:14 UTC
When compiling with clang this compilation error is raised: Making all in rtsp-server make[3]: Entering directory '/opt/gst/master/gst-rtsp-server/gst/rtsp-server' CC libgstrtspserver_1.0_la-rtsp-onvif-media.lo rtsp-onvif-media.c:103:16: error: variable 'res' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (!sinkpad && !gst_caps_is_fixed (caps)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rtsp-onvif-media.c:111:17: note: uninitialized use occurs here for (j = 0; res && j < n_caps; j++) { ^~~ rtsp-onvif-media.c:103:12: note: remove the 'if' if its condition is always true } else if (!sinkpad && !gst_caps_is_fixed (caps)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rtsp-onvif-media.c:103:16: error: variable 'res' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] } else if (!sinkpad && !gst_caps_is_fixed (caps)) { ^~~~~~~~ rtsp-onvif-media.c:111:17: note: uninitialized use occurs here for (j = 0; res && j < n_caps; j++) { ^~~ rtsp-onvif-media.c:103:16: note: remove the '&&' if its condition is always true } else if (!sinkpad && !gst_caps_is_fixed (caps)) { ^~~~~~~~~~~ rtsp-onvif-media.c:82:17: note: initialize the variable 'res' to silence this warning gboolean res; ^ = 0 2 errors generated.
Created attachment 368553 [details] [review] rtp-server: remove redefined variable res is a boolean variable which is defined in the function scope and redefined, with no reason, in the loop scope. This patch removes the redefinition.
Comment on attachment 368553 [details] [review] rtp-server: remove redefined variable Thanks. I think you should feel free to push things like that directly in future without a bug report, if you want to.
Attachment 368553 [details] pushed as b7e8198 - rtp-server: remove redefined variable