[FFmpeg-devel] [PATCH] avcodec: use HAVE_THREADS header guards to silence -Wunused-function

Michael Niedermayer michaelni at gmx.at
Sat Oct 3 20:25:16 CEST 2015


On Sat, Oct 03, 2015 at 11:13:35AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Thu, Sep 17, 2015 at 7:51 AM, Michael Niedermayer <michaelni at gmx.at>
> wrote:
> 
> > On Thu, Sep 17, 2015 at 06:54:37AM -0400, Ganesh Ajjanagadde wrote:
> > > On Thu, Sep 17, 2015 at 6:17 AM, Michael Niedermayer <michaelni at gmx.at>
> > wrote:
> > > > On Wed, Sep 16, 2015 at 10:22:27PM -0400, Ganesh Ajjanagadde wrote:
> > > >> When compiled with --disable-pthreads, e.g
> > > >>
> > http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7
> > ,
> > > >> a bunch of -Wunused-functions are reported due to missing header
> > guards
> > > >> around threading related functions.
> > > >> This patch should silence such warnings.
> > > >>
> > > >> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> > > >> ---
> > > >>  libavcodec/alac.c          | 2 ++
> > > >>  libavcodec/exr.c           | 2 ++
> > > >>  libavcodec/ffv1dec.c       | 4 ++++
> > > >>  libavcodec/flacdec.c       | 2 ++
> > > >>  libavcodec/h264.c          | 2 ++
> > > >>  libavcodec/huffyuvdec.c    | 2 ++
> > > >>  libavcodec/mdec.c          | 2 ++
> > > >>  libavcodec/mimic.c         | 4 ++++
> > > >>  libavcodec/mpeg12dec.c     | 2 ++
> > > >>  libavcodec/mpeg4videodec.c | 2 ++
> > > >>  libavcodec/pngdec.c        | 2 ++
> > > >>  libavcodec/takdec.c        | 2 ++
> > > >>  libavcodec/tta.c           | 2 ++
> > > >>  libavcodec/vp3.c           | 4 ++++
> > > >>  libavcodec/vp8.c           | 2 ++
> > > >>  libavcodec/vp9.c           | 2 ++
> > > >>  libavcodec/wavpack.c       | 2 ++
> > > >>  17 files changed, 40 insertions(+)
> > > >
> > > > av_unused might be simpler to silence these warnings than #if
> > >
> > > I do not think this is consistent at the moment across the codebase;
> > > sometimes we use header guards and sometimes we use av_unused. Please
> > > tell me if what the rationale is for either of them; I am fine either
> > > way. Any half decent compiler should anyway remove unused functions
> > > when compiled with optimizations.
> >
> > #ifs will be more work to maintain as they can break build if a new
> > function call or function is added. av_unused cannot break build
> > #ifs also make the code harder to read, especially if there are
> > already some #ifs there before
> >
> > #ifs make sense for non static symbols as they cannot be removed by
> > the compiler or linker generally
> >
> > #ifs could also be used to structure code in a file if for some
> > reason its unwanted to split it in several files
> > #ifs also gurantee that code is removed and this makes sense in
> > performance critical code
> > #ifs can be used for any group of lines not just functions/variables
> > as for av_unused
> 
> 
> Michael, how strong is your objection here? Me and wm4 seem to have a
> slight preference for #if over av_unused, since av_unused runs the risk of
> rotting with code over time.

iam almost neutral to the #if vs ununsed vs nothing question.
i just felt that av_unused would be less work to maintain than #if,
iam fine with any of the 3

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

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151003/e5ced5a4/attachment.sig>


More information about the ffmpeg-devel mailing list