[FFmpeg-devel] [PATCH] avutil/atomics: replace avpriv atomics with stdatomics

Hendrik Leppkes h.leppkes at gmail.com
Sat Dec 16 01:48:33 EET 2017


On Sat, Dec 16, 2017 at 12:04 AM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Fri, Dec 15, 2017 at 06:11:34PM +0000, Josh de Kock wrote:
>> On Fri, 15 Dec 2017 18:08:02 +0000
>> Josh de Kock <josh at itanimul.li> wrote:
>>
>> > [...]
>>
>> Attached again with the correct mime...
>>
>> --
>> Josh de Kock <josh at itanimul.li>
>
>>  b/libavcodec/error_resilience.c |    1
>>  b/libavcodec/parser.c           |    4 -
>>  b/libavcodec/utils.c            |   13 ++--
>>  b/libavfilter/avfilter.c        |    5 +
>>  b/libavformat/format.c          |    9 +--
>>  b/libavutil/Makefile            |    6 --
>>  b/tests/fate/libavutil.mak      |    5 -
>>  libavutil/atomic.c              |  109 ----------------------------------------
>>  libavutil/atomic.h              |   79 ----------------------------
>>  libavutil/atomic_gcc.h          |   61 ----------------------
>>  libavutil/atomic_suncc.h        |   54 -------------------
>>  libavutil/atomic_win32.h        |   54 -------------------
>>  libavutil/tests/atomic.c        |   38 -------------
>>  13 files changed, 17 insertions(+), 421 deletions(-)
>> 6c235f1bdd516f693810c7edaa8eded3e01f1405  0001-avutil-atomics-replace-avpriv-atomics-with-stdatomics.patch
>> From 2c4771a24510adfb3f6346c3fbed0554034eab3b Mon Sep 17 00:00:00 2001
>> From: Josh de Kock <josh at itanimul.li>
>> Date: Fri, 15 Dec 2017 09:29:55 -0800
>> Subject: [PATCH] avutil/atomics: replace avpriv atomics with stdatomics
>
> This fails to build with gcc (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
>
> make
> CC      libavfilter/avfilter.o
> libavfilter/avfilter.c: In function ‘avfilter_register’:
> libavfilter/avfilter.c:603:43: error: expected ‘)’ before ‘_Atomic’
>      while(*f || !atomic_compare_exchange_weak((AVFilter* _Atomic*) f, &filter->next, filter))
>                                            ^
> libavfilter/avfilter.c:603:63: warning: initialization from incompatible pointer type [enabled by default]
>      while(*f || !atomic_compare_exchange_weak((AVFilter* _Atomic*) f, &filter->next, filter))
>                                                                ^
> libavfilter/avfilter.c:603:103: error: expected ‘)’ before ‘_Atomic’
>      while(*f || !atomic_compare_exchange_weak((AVFilter* _Atomic*) f, &filter->next, filter))
>                                                                                                        ^
> libavfilter/avfilter.c:603:178: error: expected ‘)’ before ‘_Atomic’
>      while(*f || !atomic_compare_exchange_weak((AVFilter* _Atomic*) f, &filter->next, filter))
>                                                                                                                                                                                   ^
> libavfilter/avfilter.c:603:178: error: incompatible type for argument 1 of ‘__sync_val_compare_and_swap’
> libavfilter/avfilter.c:603:215: error: invalid operands to binary == (have ‘AVFilter’ and ‘AVFilter’)
>      while(*f || !atomic_compare_exchange_weak((AVFilter* _Atomic*) f, &filter->next, filter))
>                                                                                                                                                                                                                        ^
> make: *** [libavfilter/avfilter.o] Error 1
>

_Atomic should probably be defined to "volatile" in both the gcc and
the msvc fallback. Still not sure the casting is really "safe" though.

- Hendrik


More information about the ffmpeg-devel mailing list