[FFmpeg-devel] [PATCH 1/2] avutil/attributes: extend av_uninit to clang

Ganesh Ajjanagadde gajjanag at mit.edu
Wed Oct 7 15:18:22 CEST 2015


On Wed, Oct 7, 2015 at 8:56 AM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Sat, Sep 19, 2015 at 01:00:17AM -0400, Ganesh Ajjanagadde wrote:
>> Commit 6dac8c8327 disabled av_uninit for clang, due to some useless warnings.
>> The concept of av_uninit is inherently useful though. This patch silences a
>> bunch of warnings on clang e.g
>> http://fate.ffmpeg.org/log.cgi?time=20150918181527&log=compile&slot=x86_64-darwin-clang-polly-vectorize-stripmine-3.7.
>> Furthermore, it should be useful for general usage of av_uninit in future.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavutil/attributes.h | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavutil/attributes.h b/libavutil/attributes.h
>> index 50e8eb3..b4b5f13 100644
>> --- a/libavutil/attributes.h
>> +++ b/libavutil/attributes.h
>> @@ -141,6 +141,12 @@
>>
>>  #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
>>  #    define av_uninit(x) x=x
>> +#elif defined(__clang__)
>> +#    define av_uninit(x) \
>> +        _Pragma("clang diagnostic push") \
>> +        _Pragma("clang diagnostic ignored \"-Wuninitialized\"") \
>> +        x=x \
>> +        _Pragma("clang diagnostic pop")
>>  #else
>
> this fails with clang version 3.1 (trunk 144800)
>
> AR      libavdevice/libavdevice.a
> CC      libavfilter/af_aecho.o
> In file included from libavfilter/af_aecho.c:1:
> libavfilter/af_aecho.c:226:315: error: expected identifier or '('
> static void echo_samples_dblp(AudioEchoContext *ctx, uint8_t **delayptrs, uint8_t * const *src, uint8_t **dst, int nb_samples, int channels) { const double out_gain = ctx->out_gain; const double in_gain = ctx->in_gain; const int nb_echoes = ctx->nb_echoes; const int max_samples = ctx->max_samples; int i, j, chan,#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wuninitialized" index=index#pragma clang diagnostic pop; ((void)0); for (chan = 0; chan < channels; chan++) { const double *s = (double *)src[chan]; double *d = (double *)dst[chan]; double *dbuf = (double *)delayptrs[chan]; index = ctx->delay_index; for (i = 0; i < nb_samples; i++, s++, d++) { double out, in; in = *s; out = in * in_gain; for (j = 0; j < nb_echoes; j++) { int ix = index + max_samples - ctx->samples[j]; ix = (((ix) >= (max_samples)) ? (ix) - (max_samples) : (ix)); out += dbuf[ix] * ctx->decay[j]; } out *= out_gain; *d = av_clipd_c(out, -1.0, 1.0); dbuf[index] = in; index = (((index + 1) >= (max_samples)) ? (index + 1) - (max_samples) : (index + 1)); } } ctx->delay_index = index; }
>                                                                                                                                                                                                                                                                                                                           ^
> ...
>
> [...]

Thanks for checking this. Guess I need to find out which clang version
introduced this and accordingly enable.

>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> When you are offended at any man's fault, turn to yourself and study your
> own failings. Then you will forget your anger. -- Epictetus
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list