mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

error when compiling on android #834

Closed zoff99 closed 6 months ago

zoff99 commented 7 months ago

the problem was ignored and now came back when updating miniaudio.

miniaudio - v0.11.21, compiling on android gives these errors:

miniaudio.h:14841:9: error: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Werror,-Watomic-alignment]

__atomic_compare_exchange_n(dst, &expected, desired, 0, ATOMIC_SEQ_CST, ATOMIC_SEQ_CST);

mackron commented 6 months ago

This should be addressed in the dev branch and will be released in the next version.

I think this was actually a false positive because it looks like Clang is only looking at the wrapper function in a bubble rather than considering the broader context. In all cases where this function is used, it's being used with properly aligned data, at least as far as I can tell. I've just forced-silenced the warning.