Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753794AbbLILw4 (ORCPT ); Wed, 9 Dec 2015 06:52:56 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:59769 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbbLILwz (ORCPT ); Wed, 9 Dec 2015 06:52:55 -0500 From: Arnd Bergmann To: Aaron Conole 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 Date: Wed, 09 Dec 2015 12:52:38 +0100 Message-ID: <1652262.soph10NRXK@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1449265902-21781-1-git-send-email-aconole@redhat.com> References: <5661BFEE.1050103@akamai.com> <1449265902-21781-1-git-send-email-aconole@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Hq5Wy9ipIz0ccc2j4MuFbhgIdHlyzP7CzKdgYm1dBiQKHIQBPMg WoJlLpuT8l8awdP1Luj8Et1UdqtDyGAtOxHQOdBBAdjh3IQ0jnHkJx38C2rU9ewGClGblVc dLIBEj/QaUmW8tklsmKdLklz9EOsdVImY9XNlNhRenA3fPDaRvRr5Ndd+YsIhcLx27fmMBp zQnBkXlczdWsI1daCmLKg== X-UI-Out-Filterresults: notjunk:1;V01:K0:jphhXeDq/Wo=:Qe2shZ1RlZrwcWsHxZlLJg HEqbulNHowqGdKV+k+Z98cARyxw1Y3f3n7IHjFKg6ri2aR3QYtobHNwaIBppy7sC50dkM3a+W 3LizPegHsRu9rIDfX6ZdW6qEnU5RP2I5zrbi+yAQ29GauGSOl+Ls2lmMApU3uobx4PVfvEoNf 2mkyFh4aGtWQJo1QdCienV26LaVeEDCmmXG0D33tbbXFOK4ccfM0XWE6SL2QXy8S7dqMDNzW1 7zLTvssuC2pGAYnI4xZkjKBpQ09NIHTpRyo6tDIvRl6Ak4RhoJE6f5xfSZJ8JMouAR8Fp0Jfi N2n+ADjbc3EBrpztrtF29ERbYpoSvy7P7hZ6bm7QV1vOVk40pyKtvgB+OShNhoTd+pTiuJWi1 80WTDDMhY3l018tTl9XpPZzp3etIdws+cN5FbtzU9PHgLtDhbsVL0atyQPK/HpfnG4tfzDSfd zL6mi5nv1U7e2Eneo8k0kyzSwhyMRmu4emyWETMXf6yaWKURZ43ggTRafGbt0RH6iWCr+nZnR GVOApMhBCZ3pUxzk/sWuXhjfvlJ4I2D8cb5n3yycTJfDHuUzBnu6sO8Uy53TrBP0ousLzXVMk N8v0EleaxpBAcCTr2DjnZPt2sYSrZ8aWPzB41edVqiiKmWpz8yT2RYaiS3XqGFxS2SQkBt+eJ RtDCNuJshC4PskLByR3DOHYXEPzn+fGJTiYxelRidYZkIYXOQSL+1hoPnlZ5fNCxGyAWieiT0 SybJN53UU3K8nhG/ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1826 Lines: 56 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) -- 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/