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 582715 - gcc warnings about unitialized
gcc warnings about unitialized
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Solaris
: Normal blocker
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-15 06:35 UTC by James Andrewartha
Modified: 2009-05-15 10:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28


Attachments
good-compiler-warnings.diff (935 bytes, patch)
2009-05-15 06:44 UTC, Sebastian Dröge (slomo)
none Details | Review
good-compiler-warnings.diff (938 bytes, patch)
2009-05-15 07:16 UTC, Sebastian Dröge (slomo)
none Details | Review
more gcc fixes (2.33 KB, patch)
2009-05-15 08:26 UTC, James Andrewartha
none Details | Review
final fixes (11.24 KB, patch)
2009-05-15 09:46 UTC, James Andrewartha
reviewed Details | Review

Description James Andrewartha 2009-05-15 06:35:47 UTC
I'm jhbuilding from git so -Werror is enabled, which turns these warnings from -Wall into an error. Firstly in gst/flv:
gstflvmux.c: In function `gst_flv_mux_collected':
gstflvmux.c:607: warning: 't' might be used uninitialized in this function
The code is:
      const gchar *t;

      if (!strcmp (tag_name, GST_TAG_ARTIST))
        t = "creator";
      else if (!strcmp (tag_name, GST_TAG_TITLE))
        t = "title";

And in sys/sunaudio:
gstsunaudiomixerctrl.c: In function `gst_sunaudiomixer_ctrl_get_volume':
gstsunaudiomixerctrl.c:179: warning: 'gain' might be used uninitialized in this function
gstsunaudiomixerctrl.c:179: warning: 'balance' might be used uninitialized in this function
The code is a switch statement that has no default case.
Comment 1 Sebastian Dröge (slomo) 2009-05-15 06:42:32 UTC
I wonder why gcc warns about the flvmux variable... my gcc detects that it will be always set to something. Whatever, patch follows ;)
Comment 2 Sebastian Dröge (slomo) 2009-05-15 06:44:20 UTC
Created attachment 134687 [details] [review]
good-compiler-warnings.diff

Please test this with your gcc, in theory it should now be clear that the variables are only used initialized
Comment 3 James Andrewartha 2009-05-15 07:09:04 UTC
It's an old version of gcc, 3.4. The flv patch works, the sunaudio one doesn't because g_assert_not_reached is undeclared.
Comment 4 Sebastian Dröge (slomo) 2009-05-15 07:16:36 UTC
Created attachment 134688 [details] [review]
good-compiler-warnings.diff

Right, parenthesis were missing after g_assert_not_reached, sorry.
Comment 5 James Andrewartha 2009-05-15 08:26:04 UTC
Created attachment 134690 [details] [review]
more gcc fixes

That works, and then this patch fixes a few more warnings. Now I'm getting this warning in sys/v4l2:
v4l2_calls.c: In function `gst_v4l2_fill_lists':
v4l2_calls.c:121: warning: missing braces around initializer
v4l2_calls.c:121: warning: (near initialization for `input.name')
v4l2_calls.c:144: warning: unsigned int format, different type arg (arg 8)
Comment 6 Sebastian Dröge (slomo) 2009-05-15 08:59:19 UTC
The 144 one needs a cast to guint, 121 proably needs to be {{ 0, }, } or something like that.
Comment 7 James Andrewartha 2009-05-15 09:46:53 UTC
Created attachment 134694 [details] [review]
final fixes

Those fixes work, here's a final patch. Thanks.
Comment 8 Sebastian Dröge (slomo) 2009-05-15 09:53:48 UTC
Actually the change to add the brackets is not correct. It will result in a warning on Linux.

I've changed it to a memset locally... apart from that we should get this committed ;)
Comment 9 Sebastian Dröge (slomo) 2009-05-15 10:03:29 UTC
commit 08a3f44d81cf715d40b57d523418997b47e2c506
Author: James Andrewartha <trs80@ucc.gu.uwa.edu.au>
Date:   Fri May 15 08:44:39 2009 +0200

    Fix compiler warnings
    
    Fixes bug #582715.