[PATCH] kselftest: alsa: Use private alsa-lib configuration in mixer test

Mark Brown broonie at kernel.org
Wed Dec 8 22:08:46 CET 2021


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20211208/a9192bee/attachment-0001.sig>


More information about the Alsa-devel mailing list