On Wed, Dec 08, 2021 at 10:52:09AM +0100, Jaroslav Kysela wrote:
+#if !defined(SND_LIB_VER) || SND_LIB_VERSION < SND_LIB_VER(1, 2, 6)
This barfs if the local definition is used since the preprocessor will try to evaluate SND_LIB_VER even if the macro is not defined and the left hand side of the || is true:
mixer-test.c:66:60: error: missing binary operator before token "(" 66 | #if !defined(SND_LIB_VER) || (SND_LIB_VERSION < SND_LIB_VER(1, 2, 6)) | ^
SND_LIB_VER was only added in v1.2.5 so currently used distros run into this. I've restructured to:
#ifdef SND_LIB_VER #if SND_LIB_VERSION >= SND_LIB_VER(1, 2, 6) #define LIB_HAS_LOAD_STRING #endif #endif
#ifndef LIB_HAS_LOAD_STRING
which is a bit ugly but splits the use of SND_LIB_VER into a separate if statement which causes the preprocessor to do the right thing.