[FFmpeg-trac] #9859(undetermined:new): Compilation warnings ATOMIC_VAR_INIT
FFmpeg
trac at avcodec.org
Wed Aug 3 08:58:12 EEST 2022
#9859: Compilation warnings ATOMIC_VAR_INIT
-------------------------------------+-------------------------------------
Reporter: Jozef | Type:
Chutka | enhancement
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
While compiling ffmpeg (commit 1368b5a) with emscripten 3.1.17, there are
two warnings, I thinks maintainers might want to look into:
```
fftools/ffmpeg.c:339:41: warning: macro 'ATOMIC_VAR_INIT' has been marked
as deprecated [-Wdeprecated-pragma]
static atomic_int transcode_init_done = ATOMIC_VAR_INIT(0);
^
/home/XYZ/ffmpeg-
wasm/modules/emsdk/upstream/lib/clang/15.0.0/include/stdatomic.h:50:41:
note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
^
```
To my knowledge, this macro was a part of early draft design for C11
atomic types. It is not needed in C11, and is deprecated in C17 and
removed in C23.
The other warning is also interesting:
```
fftools/ffmpeg_filter.c:898:35: warning: floating-point comparison is
always true; constant cannot be represented exactly in type 'float'
[-Wliteral-range]
if (audio_drift_threshold != 0.1)
~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
```
It turns out that 0.1 is one of the numbers that it is impossible to
encode in binary floating point. And according to the message the
condition is as good as having `if(true)` in place. Consider using
epsilon:
```
if (abs(audio_drift_threshold - 0.1) < epsilon)
```
The SO helped me with some information
https://stackoverflow.com/questions/73203857/ffmpeg-compilation-warnings-
atomic-var-init
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9859>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list