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 325599 - Build fails with GCC 4.1
Build fails with GCC 4.1
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 325604 335828 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-01-03 10:14 UTC by Kjartan Maraas
Modified: 2006-03-24 20:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case for compiler warning (407 bytes, text/plain)
2006-01-16 12:07 UTC, Andy Wingo
  Details
Patch for core compilation with gcc 4.1 (24.37 KB, patch)
2006-03-19 15:24 UTC, Edward Hervey
none Details | Review
Updated version (16.76 KB, patch)
2006-03-19 17:09 UTC, Edward Hervey
none Details | Review
patch for gst-plugins-base (4.33 KB, patch)
2006-03-19 17:11 UTC, Edward Hervey
committed Details | Review
patch for gst-plugins-good (3.96 KB, patch)
2006-03-19 17:12 UTC, Edward Hervey
committed Details | Review
static inline functions for gst_[buffer|event|message]_ref() (3.44 KB, patch)
2006-03-20 10:03 UTC, Edward Hervey
none Details | Review
other gcc4.1 fixes for core. (13.32 KB, patch)
2006-03-20 10:04 UTC, Edward Hervey
committed Details | Review
More efficient version of gst_[buffer|event|message]_ref() (2.34 KB, patch)
2006-03-21 13:25 UTC, Edward Hervey
committed Details | Review

Description Kjartan Maraas 2006-01-03 10:14:50 UTC
Tried building gstreamer with GCC 4.1 on a fedora rawhide setup here with jhbuild, but it fails with the following warnings:

 gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pthread -I/opt/gnome/ include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -I/opt/gnome/include/libxml2 -D_LARGEFILE_SOURCE -D_FILE_OFFSE T_BITS=64 -fno-common -g -Wall -Werror -DGST_DISABLE_DEPRECATED -m32 -mpreferred-stack-boundary=2 -I/usr/include/ valgrind -I.. -DGST_MAJORMINOR=\"0.8\" -Wall -g -O0 -MT libgstreamer_0.8_la-gst.lo -MD -MP -MF .deps/libgstreamer _0.8_la-gst.Tpo -c gst.c  -fPIC -DPIC -o .libs/libgstreamer_0.8_la-gst.o
cc1: warnings being treated as errors
gst.c: In function 'init_post':
gst.c:589: warning: statement with no effect
gst.c:615: warning: statement with no effect
gst.c:617: warning: statement with no effect
make[4]: *** [libgstreamer_0.8_la-gst.lo] Error 1
make[4]: Leaving directory `/home/kmaraas/cvs/gnome214/gstreamer/gst'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/kmaraas/cvs/gnome214/gstreamer/gst'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/kmaraas/cvs/gnome214/gstreamer/gst'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kmaraas/cvs/gnome214/gstreamer'
make: *** [all] Error 2
*** error during stage build of gstreamer: could not build module *** [11/84]
Comment 1 Kjartan Maraas 2006-01-03 10:16:46 UTC
One more warning later on:

cc1: warnings being treated as errors
gstidentity.c: In function 'gst_identity_chain':
gstidentity.c:361: warning: value computed is not used

Comment 2 Tim-Philipp Müller 2006-01-04 00:15:04 UTC
(a)
The first bunch should be fixed in CVS:

2006-01-04  Tim-Philipp Muller  <tim at centricular dot net>

        * gst/gstcaps.h:
        * gst/gstdata.h:
        * gst/gstprobe.h:
        * gst/gststructure.h:
        * gst/gsttaginterface.h:
          Don't use G_GNUC_CONST for _get_type() functions (see #324530
          and http://wingolog.org/archives/2005/03/24/98 for why); yes, we
          aim to please even unreleased and mind-boggingly cranky compilers.


Not sure yet how to tell gcc-4.1 that it's okay to ignore the return value of gst_foo_bar_ref()/unref().


(b)
jhbuild should probably disable -Werror when building GStreamer from CVS, as per our FAQ, see also http://bugzilla.gnome.org/show_bug.cgi?id=324530#c6 .
Comment 3 Andy Wingo 2006-01-16 10:55:04 UTC
Regarding (b), sounds like a compiler bug to me.. unsure.

Note that gst_buffer_ref (buf) expands to

(GstBuffer*)(gst_data_ref ((GstData*)(buf)))

And gst_data_ref is not a const function or anything like that. Perhaps it's the cast of the return value that's bothering the compiler? Note this same problem should show up with 0.10 as well. Sounds like an overly cranky compiler to me.
Comment 4 Andy Wingo 2006-01-16 12:07:37 UTC
Created attachment 57467 [details]
test case for compiler warning

OK attaching a brief test case that shows this issue. Compile with

gcc -Wall -c -o test test.c
Comment 5 Andy Wingo 2006-01-16 12:08:58 UTC
The problem appears to be the cast in the return value. Not sure why the GCC folks consider this to mean that the return value is necessary.
Comment 6 Andy Wingo 2006-01-16 15:10:02 UTC
Pushed upstream: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25810

Updating version, because it affects HEAD as well.
Comment 7 Andy Wingo 2006-01-16 15:52:08 UTC
Gah, upstream marked as a dupe of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24900, which links to http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00275.html which claims this is intended behavior. Must think more about this.
Comment 8 Tim-Philipp Müller 2006-03-13 09:21:24 UTC
I suppose we'll have to make gst_buffer_ref() and gst_event_ref() either static inline functions then, or proper functions, no?
Comment 9 Edward Hervey 2006-03-19 15:23:32 UTC
Attached is a patch for making core compile with gcc 4.1 without any warnings.

It seems to work fine although I get an error when running make check:

Running suite(s): LibsABINo structure size list was generated for this architecture
ignoring

100%: Checks: 1, Failures: 0, Errors: 0
PASS: libs/libsabi
Running suite(s): GstBaseSrc
50%: Checks: 4, Failures: 0, Errors: 2
libs/basesrc.c:164:E:general:basesrc_eos_events_push: (after this point) Test timeout expired
libs/basesrc.c:94:E:general:basesrc_eos_events_push_live_op: (after this point) Test timeout expired
FAIL: libs/basesrc
Running suite(s): Controller
100%: Checks: 15, Failures: 0, Errors: 0
PASS: libs/controller
Running suite(s): data protocol
100%: Checks: 4, Failures: 0, Errors: 0
PASS: libs/gdp
Running suite(s): GstNetClientClock
100%: Checks: 2, Failures: 0, Errors: 0
PASS: libs/gstnetclientclock
Running suite(s): GstNetTimeProvider
100%: Checks: 2, Failures: 0, Errors: 0
PASS: libs/gstnettimeprovider
====================
1 of 39 tests failed
====================
Comment 10 Edward Hervey 2006-03-19 15:24:32 UTC
Created attachment 61544 [details] [review]
Patch for core compilation with gcc 4.1
Comment 11 Michael Smith 2006-03-19 15:31:49 UTC
foo = gst_blah_ref(foo) is not appropriate for working around these warnings.

A (void) cast would be ok... except these are going to bite everyone USING gstreamer as well. We should do as recommended and use statement expressions to work around these (for gcc; for non-gcc the existing macros will be fine).

The last two hunks in the file are wrong, I assume you didn't mean to include them.
Comment 12 Edward Hervey 2006-03-19 17:09:31 UTC
Created attachment 61553 [details] [review]
Updated version

This is a much saner patch.

The main modifications are:
_ making gst_[buffer|event|message]_ref() static inline functions.
_ Handling dereferenced pointers correctly.
Comment 13 Edward Hervey 2006-03-19 17:11:29 UTC
Created attachment 61554 [details] [review]
patch for gst-plugins-base
Comment 14 Edward Hervey 2006-03-19 17:12:22 UTC
Created attachment 61555 [details] [review]
patch for gst-plugins-good
Comment 15 Andy Wingo 2006-03-20 09:28:28 UTC
I think it would be good to separate out your core patch into the GstObject** type-punning one and the one for gst_buffer_ref and friends.

I'm not sure that "static inline" is portable; would have to check. I'm sure that Mike will have more opinions aboot this...
Comment 16 Michael Smith 2006-03-20 09:57:45 UTC
'static inline' itself isn't portable, but __tim said that glib defines 'inline' to something appropriate; I didn't confirm this.

I suppose it'd be nice to see two seperate patches, but I'd like to see this go in sooner rather than later.
Comment 17 Edward Hervey 2006-03-20 10:03:50 UTC
Created attachment 61601 [details] [review]
static inline functions for gst_[buffer|event|message]_ref()
Comment 18 Edward Hervey 2006-03-20 10:04:48 UTC
Created attachment 61602 [details] [review]
other gcc4.1 fixes for core.

Second part of core patch split up
Comment 19 Edward Hervey 2006-03-21 13:25:35 UTC
Created attachment 61686 [details] [review]
More efficient version of gst_[buffer|event|message]_ref()

The previous version was doing typechecking (using the GST_[BUFFER|EVENT|MESSAGE] macro). This is not necessary in fact, so a simple cast while do.
Comment 20 Edward Hervey 2006-03-21 14:18:11 UTC
core is now fixed.

2006-03-21  Edward Hervey  <edward@fluendo.com>

	reviewed by: <delete if not using a buddy>

	* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
	(gst_bin_handle_message_func):
	* gst/gstclock.c: (gst_clock_dispose), (gst_clock_set_master):
	* gst/gstelement.c: (gst_element_set_clock), (gst_element_dispose),
	(gst_element_set_bus_func):
	* gst/gstghostpad.c: (gst_proxy_pad_dispose):
	* gst/gstminiobject.c: (gst_value_set_mini_object),
	(gst_value_take_mini_object):
	* gst/gstpad.c: (gst_pad_set_pad_template):
	* gst/gstpipeline.c: (gst_pipeline_dispose),
	(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
	* libs/gst/base/gstcollectpads.c: (gst_collect_pads_pop),
	(gst_collect_pads_chain):
	* libs/gst/net/gstnettimeprovider.c:
	(gst_net_time_provider_set_property):
	Series of fixes for dereferenced pointers that gcc 4.1 complains about.
	It's in fact all issues with gst_*object_replace().


2006-03-21  Edward Hervey  <edward@fluendo.com>

	* gst/gstbuffer.h:
	* gst/gstevent.h:
	* gst/gstmessage.h:
	gst_[buffer|event|message]_ref() macros are replaced by a static
	inline functions because gcc-4.1 will about if the return value
	isn't used.
	* tests/check/gst/gstevent.c: (event_probe):
	gst_event_ref now has to be given a GstEvent* , fix check accordingly.

Comment 21 Edward Hervey 2006-03-21 14:29:49 UTC
And now -base is gcc 4.1 friendly

2006-03-21  Edward Hervey  <edward@fluendo.com>

	* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
	* gst/playback/gstplaybin.c: (handoff):
	* gst/playback/gststreamselector.c:
	(gst_stream_selector_set_property):
	gcc 4.1 unreferenced pointer fixes.
	* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put):
	* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put):
	gst_buffer_ref() now takes a GstBuffer*.

Comment 22 Edward Hervey 2006-03-21 15:00:14 UTC
-good is gcc 4.1 friendly.

2006-03-21  Edward Hervey  <edward@fluendo.com>

	* gst/apetag/gsttagdemux.c: (gst_tag_demux_reset):
	* gst/id3demux/gstid3demux.c: (gst_id3demux_reset):
	* gst/wavparse/gstwavparse.c: (gst_wavparse_create_sourcepad),
	(gst_wavparse_stream_headers), (gst_wavparse_send_event),
	(gst_wavparse_change_state):
	gcc 4.1 unreferenced pointer fixes.

Comment 23 Edward Hervey 2006-03-21 15:09:52 UTC
Everything fixed, closing bug.
Comment 24 Tim-Philipp Müller 2006-03-24 12:13:36 UTC
*** Bug 335828 has been marked as a duplicate of this bug. ***
Comment 25 Wim Taymans 2006-03-24 20:12:29 UTC
*** Bug 325604 has been marked as a duplicate of this bug. ***