From da662ef182a5f62ec0c75aa43cbd94d5647add2a Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 17 Jan 2018 12:10:41 +0100 Subject: Fix undefined preprocessor behavior This commit eliminates the following clang warning: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined] Going by the clang commit message, this seems to be explicitly specified as UB by the standard, and they added this warning because MSVC apparently results in different behavior. Whatever, we can just avoid the warning with some small changes. --- audio/out/ao_alsa.c | 7 +++++-- audio/out/ao_oss.c | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 39c3f03118..b86bf5d89e 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -42,8 +42,11 @@ #include -#define HAVE_CHMAP_API \ - (defined(SND_CHMAP_API_VERSION) && SND_CHMAP_API_VERSION >= (1 << 16)) +#if defined(SND_CHMAP_API_VERSION) && SND_CHMAP_API_VERSION >= (1 << 16) +#define HAVE_CHMAP_API 1 +#else +#define HAVE_CHMAP_API 0 +#endif #include "ao.h" #include "internal.h" diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 72413cd9f8..1300a72043 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -56,7 +56,11 @@ // Define to 0 if the device must be reopened to reset it (stop all playback, // clear the buffer), and the device should be closed when unused. // Define to 1 if SNDCTL_DSP_RESET should be used to reset without close. -#define KEEP_DEVICE (defined(SNDCTL_DSP_RESET) && !defined(__NetBSD__)) +#if defined(SNDCTL_DSP_RESET) && !defined(__NetBSD__) +#define KEEP_DEVICE 1 +#else +#define KEEP_DEVICE 0 +#endif #define PATH_DEV_DSP "/dev/dsp" #define PATH_DEV_MIXER "/dev/mixer" -- cgit v1.2.3