Re: [PATCH next-20130124] Sound: pci: Fix unused variable warning in patch_sigmatel.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
 {


--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux