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

Aurelien Jacobs aurel
Thu Aug 21 00:37:37 CEST 2008


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.

Aurel




More information about the ffmpeg-devel mailing list