Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbbLIPN3 (ORCPT ); Wed, 9 Dec 2015 10:13:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50787 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbbLIPN2 (ORCPT ); Wed, 9 Dec 2015 10:13:28 -0500 From: Aaron Conole To: Arnd Bergmann Cc: Andrew Morton , linux-kernel@vger.kernel.org, Jason Baron , Joe Perches Subject: Re: [PATCH v2] printk: help pr_debug and pr_devel to optimize out arguments References: <5661BFEE.1050103@akamai.com> <1449265902-21781-1-git-send-email-aconole@redhat.com> <1652262.soph10NRXK@wuerfel> Date: Wed, 09 Dec 2015 10:13:26 -0500 In-Reply-To: <1652262.soph10NRXK@wuerfel> (Arnd Bergmann's message of "Wed, 09 Dec 2015 12:52:38 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2014 Lines: 58 Arnd Bergmann writes: > On Friday 04 December 2015 16:51:42 Aaron Conole wrote: >> --- a/include/linux/printk.h >> +++ b/include/linux/printk.h >> @@ -106,13 +106,14 @@ struct va_format { >> >> /* >> * Dummy printk for disabled debugging statements to use whilst maintaining >> - * gcc's format and side-effect checking. >> + * gcc's format checking. >> */ >> -static inline __printf(1, 2) >> -int no_printk(const char *fmt, ...) >> -{ >> - return 0; >> -} >> +#define no_printk(fmt, ...) \ >> +do { \ >> + if (0) { \ >> + printk(fmt, ##__VA_ARGS__); \ >> + } \ >> +} while (0) >> > > This change breaks compiling lib/842/, at least in some configurations: > > lib/842/842_decompress.c: In function '__do_index': > lib/842/842_decompress.c:205:12422: error: implicit declaration of function 'no_printk' > > Using a gcc style vararg macro instead of the C99 style makes it work, but > I don't know why the original version didn't work. > > Signed-off-by: Arnd Bergmann > > diff --git a/include/linux/printk.h b/include/linux/printk.h > index cc3803a8f73e..4d1851a82254 100644 > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -108,10 +108,10 @@ struct va_format { > * Dummy printk for disabled debugging statements to use whilst maintaining > * gcc's format checking. > */ > -#define no_printk(fmt, ...) \ > +#define no_printk(arg ...) \ > do { \ > if (0) { \ > - printk(fmt, ##__VA_ARGS__); \ > + printk(arg); \ > } \ > } while (0) > Ugh. Sorry about this; I thought I had compiled everywhere but I guess not. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/