[FFmpeg-devel] [PATCH] The definition of av_always_inline with --enable-small or --disable-optimizations

Martin Storsjö martin
Wed Dec 15 22:11:13 CET 2010


On Wed, 15 Dec 2010, Martin Storsj? wrote:

> On Wed, 15 Dec 2010, Martin Storsj? wrote:
> 
> > On Tue, 14 Dec 2010, Michael Niedermayer wrote:
> > 
> > > On Tue, Dec 14, 2010 at 10:48:49PM +0200, Martin Storsj? wrote:
> > > > On Tue, 14 Dec 2010, Michael Niedermayer wrote:
> > > > 
> > > > > On Tue, Dec 14, 2010 at 11:28:36AM +0200, Martin Storsj? wrote:
> > > > > > Hi,
> > > > > > 
> > > > > > At the end of the configure script, we currently do this:
> > > > > > 
> > > > > > if enabled small || disabled optimizations; then
> > > > > >     echo "#undef  av_always_inline"  >> $TMPH
> > > > > >     echo "#define av_always_inline"  >> $TMPH
> > > > > > fi
> > > > > > 
> > > > > > This causes a lot of warnings when building with either of these 
> > > > > > configurations, warnings like this one:
> > > > > > 
> > > > > > ./libavutil/x86/bswap.h:32: warning: ?av_bswap16? defined but not used
> > > > > > 
> > > > > > These warnings can be silenced either by adding -Wno-unused-function to 
> > > > > > the cflags, or by changing the definition of av_always_inline for this 
> > > > > > case. Possible options are:
> > > > > > 
> > > > > > - empty, as currently, spewing lots of warnings
> > > > > > - inline (as opposed to the __attribute__((always_inline) used otherwise), 
> > > > > >   but that won't avoid all inlineing even if the user requested 
> > > > > >   --disable-optimizations
> > > > > 
> > > > > > - __attribute__((unused)), which seems to be supported since gcc 2.95
> > > > > 
> > > > > This would suppress unused warnings incorrectly
> > > > 
> > > > Only for builds with --disable-optimizations or for --enable-small. 
> > > > Currently, in those build configurations, it's really hard to see the 
> > > > relevant warnings since the console is totally spammed with the warnings 
> > > > for all the defined but unused static av_always_inline functions.
> > > > 
> > > > For all occurrances of av_always_inline functions in headers, I see no 
> > > > issue with __attribute__((unused)).
> > > > 
> > > > Would you prefer the version where av_always_inline is redefined as 
> > > > "inline" for --enable-small builds (but as __attribute__((unused)) for 
> > > > --disable-optimizations)?
> > > 
> > > I would slightly prefer this unless it makes small bigger by a non trivial
> > > amount
> > 
> > This version is attached now.
> > 
> > It doesn't seem to make it bigger at all in a normal build with 
> > --enable-small, probably since gcc doesn't choose to inline any of those 
> > functions when -Os is specified.
> 
> Updated, much neater version of the same thing, using av_unused which we 
> already have defined in libavutil/attributes.h.

Any objections to committing this patch?

// Martin



More information about the ffmpeg-devel mailing list