[FFmpeg-devel] [PATCH][RFC] -std=c99

Michael Niedermayer michaelni
Thu Aug 21 01:35:06 CEST 2008


On Thu, Aug 21, 2008 at 12:37:37AM +0200, Aurelien Jacobs wrote:
> Diego Biurrun wrote:
> 
> > On Wed, Aug 13, 2008 at 01:44:47AM +0200, Aurelien Jacobs wrote:
> > > Michael Niedermayer wrote:
> > > 
> > > > On Tue, Aug 12, 2008 at 11:20:06PM +0100, M?ns Rullg?rd wrote:
> > > > > Michael Niedermayer <michaelni at gmx.at> writes:
> > > > > >
> > > > > > done, the following works for me too
> > > > > >
> > > > > > lower values of _XOPEN_SOURCE fail with:
> > > > > > ffserver.c:4474: error: ?SA_RESTART? undeclared (first use in this function)
> > > > > >
> > > > > > --- configure	(revision 14508)
> > > > > > +++ configure	(working copy)
> > > > > > @@ -1827,6 +1827,7 @@
> > > > > >  enabled extra_warnings && check_cflags -Winline
> > > > > > +check_cflags -std=c99 -fasm -D_POSIX_C_SOURCE=199309 -D_XOPEN_SOURCE=500
> > > > > 
> > > > > I'd just go with -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600.
> > > > 
> > > > why?
> > > > Is there anything that has been added to them that we need?
> > > > The whole point of my patch is to keep the set of dependancies for ffmpeg
> > > > small.
> > > 
> > > I agree.
> > > 
> > > And in this spirit, have a look at attached patch. It restrict definition
> > > of _XOPEN_SOURCE to ffserver.c. It also define 3 mathematics constants
> > > which are not worth defining _XOPEN_SOURCE IMO.
> > > With this applied, you can simply drop -D_XOPEN_SOURCE=500 from your patch.
> > 
> > Hmmm, I'm not sure we can do without a global _XOPEN_SOURCE.
> > 
> > It is needed for random(), which is used in many of our internal test
> > programs.  Just run 'make tests' and watch a multitude of implicit
> > declaration warnings related to random() scroll by...
> > 
> > The following files define _XOPEN_SOURCE themselves:
> > 
> > ffmpeg.c
> > ffserver.c
> > libavcodec/utils.c
> > libavformat/rtpdec.c
> > 
> > The following files use random() in some place or another:
> > 
> > libavcodec/fft-test.c
> > libavcodec/rangecoder.c
> > libavcodec/ac3enc.c
> > libavcodec/snow.c
> > libavcodec/cabac.c
> > libavcodec/h264.c
> > libavcodec/dct-test.c
> > libavcodec/motion-test.c
> > libavutil/pca.c
> > libavutil/aes.c
> > libavutil/tree.c
> > libswscale/swscale-example.c
> > tools/trasher.c
> > 
> > This makes it 4 + 13 = 17 files.  Adding _XOPEN_SOURCE everywhere will
> > start to get cumbersome.  I think it's preferable to add it to the
> > global command line.  Thoughts?
> 
> Maybe all those 13 internal tests should use av_random or av_lfg_get
> (or any appropriate internal RNG).
> This would also avoid 13 ugly #undef random.

patch welcome, and av_lfg_get /lcg / mlfg is prefered over MT (actually
i like to drop MT ...)
as i see no sense in the semi strong and slow numbers it generates
for normal purposes (white noise ...) any random number generator should
do. For cryptographic purposes MT is not useable as its trivial to
calcuate future and past numbers (its purely linear RNG).
And we dont do some kind of scientific theory testing where the simple
generators may be a bad choice ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080821/822e868a/attachment.pgp>



More information about the ffmpeg-devel mailing list