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

2 error when compiling on android #734

Closed zoff99 closed 1 year ago

zoff99 commented 1 year ago

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

miniaudio.h:77481:23: error: signed shift result (0x8000000000000000) sets the sign bit of the shift expression's type ('ma_int64' (aka 'long long')) and becomes negative [-Werror,-Wshift-sign-overflow] return sign ? MA_DR_WAV_INT64_MIN : MA_DR_WAV_INT64_MAX;

miniaudio.h:77485:23: error: signed shift result (0x8000000000000000) sets the sign bit of the shift expression's type ('ma_int64' (aka 'long long')) and becomes negative [-Werror,-Wshift-sign-overflow] return sign ? MA_DR_WAV_INT64_MIN : MA_DR_WAV_INT64_MAX;

mackron commented 1 year ago

Thanks. I actually wasn't able to replicate this, but I've nonetheless done a possible fix. It's in the dev branch. Are you able to give that a try?

zoff99 commented 1 year ago

now its giving this error:

miniaudio.h:14833: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);

zoff99 commented 1 year ago

121 warnings and 1 error generated.

also there are a bunch of warnings that may be something to fix.

warning: comparing floating point with == or != is unsafe [-Wfloat-equal] note: expanded from macro 'ma_dr_wav_offset_ptr'

zoff99 commented 1 year ago

735

mackron commented 1 year ago

That -Watomic-alignment warning is a false positive. It probably needs to be silenced somehow, but I don't want to disable the warning at the level of the entire file so I'm not sure how to address that. You might need to disable that warning in your build system.

I have no interest in addressing -Wfloat-equal. You'll need to disable that warning. Note that I'm not supporting any warnings that are enabled in -Weverything.

zoff99 commented 1 year ago

you dont have to. i just wanted to show you that they are there. i know how to disable them in my project.