public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches•com>
To: Takashi Iwai <tiwai@suse•de>
Cc: Stratos Karafotis <stratosk@semaphore•gr>,
	Jaroslav Kysela <perex@perex•cz>,
	David Henningsson <david.henningsson@canonical•com>,
	alsa-devel@alsa-project•org, linux-kernel@vger•kernel.org,
	linux-next@vger•kernel.org
Subject: Re: [PATCH next-20130124] Sound: pci: Fix unused variable warning in patch_sigmatel.c
Date: Fri, 25 Jan 2013 02:03:16 -0800	[thread overview]
Message-ID: <1359108196.2686.6.camel@joe-AO722> (raw)
In-Reply-To: <s5hehh9d3x7.wl%tiwai@suse.de>

On Fri, 2013-01-25 at 10:09 +0100, Takashi Iwai wrote:
> At Fri, 25 Jan 2013 00:38:06 +0200,
> Stratos Karafotis wrote:
> > Fix the following build warnings
> > sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
> > sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]
[]
> I'm going to fix the definition of snd_printd() itself for fixing this
> kind of warnings.  We can use inline functions instead of empty macros
> to achieve the same but without triggering compiler warnings.

It's probably better to use a macro like:

do {						\
	if (0)					\
		printk(fmt, ##__VA_ARGS__);	\
} while (0)

to allow the compiler to avoid any argument evaluation
while still doing fmt/arg matching.

Something like:

 include/sound/core.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/sound/core.h b/include/sound/core.h
index 93896ad..ce5d224 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -394,8 +394,17 @@ void __snd_printk(unsigned int level, const char *file, int line,
 
 #else /* !CONFIG_SND_DEBUG */
 
-#define snd_printd(fmt, args...)	do { } while (0)
-#define _snd_printd(level, fmt, args...) do { } while (0)
+#define snd_printd(fmt, ...)						\
+do {									\
+	if (0)								\
+		__snd_printk(1, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+} while (0)
+#define _snd_printd(level, fmt, ...)					\
+do {									\
+	if (0)								\
+		__snd_printk(level, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+} while (0)
+
 #define snd_BUG()			do { } while (0)
 static inline int __snd_bug_on(int cond)
 {

  reply	other threads:[~2013-01-25 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 22:38 [PATCH next-20130124] Sound: pci: Fix unused variable warning in patch_sigmatel.c Stratos Karafotis
2013-01-25  9:09 ` Takashi Iwai
2013-01-25 10:03   ` Joe Perches [this message]
2013-01-25 10:17     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359108196.2686.6.camel@joe-AO722 \
    --to=joe@perches$(echo .)com \
    --cc=alsa-devel@alsa-project$(echo .)org \
    --cc=david.henningsson@canonical$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=perex@perex$(echo .)cz \
    --cc=stratosk@semaphore$(echo .)gr \
    --cc=tiwai@suse$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox