Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1644533

[PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro
Date 2017-05-18 15:40 +0200
Message-ID <tItON-3bL-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Recent compilers produce a harmless warning for the new pcm_call_notify()
macro when CONFIG_SND_PCM_OSS is disabled:

sound/core/pcm.c: In function 'snd_pcm_free':
sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

This turns the empty macro into a 'do {} while (0)' statement to avoid
the warning.

Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/core/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 24acbfb5c531..d30dba0ee688 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -894,7 +894,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
 			_notify->call(pcm);				\
 	} while (0)
 #else
-#define pcm_call_notify(pcm, call) /* NOP */
+#define pcm_call_notify(pcm, call) do {} while (0)
 #endif
 
 static int snd_pcm_free(struct snd_pcm *pcm)
-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro Arnd Bergmann <arnd@arndb.de> - 2017-05-18 15:40 +0200
  [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as const Arnd Bergmann <arnd@arndb.de> - 2017-05-18 15:40 +0200
    Re: [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as  const Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2017-05-18 16:10 +0200
  Re: [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro Takashi Iwai <tiwai@suse.de> - 2017-05-18 16:40 +0200

csiph-web