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

Martin Storsjö martin
Tue Dec 14 10:28:36 CET 2010


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

Ideally, this fallback should be defined in libavutil/attributes.h I 
think, but config.h isn't included at the point when that file is 
included, so short of restructuring that (which I won't venture into, 
since I think there's a good reason for the current structure) I guess the 
overriding define still needs to be defined in configure.

The attached patch implements this.

A slight variation would be to define av_always_inline as "inline" for 
--enable-small and as __attribute__((unused)) for --disable-optimizations. 
This still makes the code smaller than with the normal definition of 
av_always_inline, but slightly larger (and probably slightly faster) than 
without inlineing anything.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure-Avoid-warnings-if-av_always_inline-is-disa.patch
Type: text/x-diff
Size: 1512 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101214/3b1ea709/attachment.patch>



More information about the ffmpeg-devel mailing list