[gst-devel] -Wsign-compare (was: Re: [gst-cvs] ...)

Benjamin Otte in7y118 at public.uni-hamburg.de
Fri May 28 06:14:06 CEST 2004

Quoting Johan Dahlin <johan at fluendo.com>:

> > - removing some trailing commas in enums to please C90 only compilers (AIX,
> Forte, ...)
> > ('should' fix #143290)
> > should/could we compile gst with -ansi -pedantic to catch those in the
> build-bots ?
> -pendantic is not useful, it turns on too many checks, which are
> pedantic. And AFAIK there is no way to turn on some of the options, like
> the trailing comman in enums/structs.
> -ansi might be a good idea if it's not already there.
> What kind of errors will it catch that we're not catching today?
I'm pretty sure we don't want those (though I have no idea what they do 
exactly), but I would like to push -Wsign-compare into core and plugins during 
the 0.9 cycle and fix with it all the API issues wrt to signedness (like 
gst_caps_get_size returning an int).

There's three reasons why I want this:
- http://yarchive.net/comp/ansic_broken_unsigned.html (raise your hand if you 
knew that)
- timestamp comparisons of GstClockTime (uint64) and GstClockTimeDiff (int64) 
esp wrt to GST_CLOCK_TIME_NONE (uint64) and constants (ints) and the implicit 
casting rules as seen in the link above. I've fixed at least three comparison 
bugs in the core because of this.
- general signed/unsigned comparison issues in many formats (like audio) where 
stuff is cast to the wrong type by accident and then doing the wrong stuff with 
it. I've fixed bugs everywhere with this, too.

So this is an announcement that I intend to add this flag (and yes, I intend to 
do the work required to fix all those bugs) pretty early in the 0.9 cycle 
unless there is resistance to it. If there are any objections, please speak 
now :)


More information about the gstreamer-devel mailing list