From: Johannes Weiner <hannes@cmpxchg.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: arjan@linux.intel.com, linux-kernel@vger.kernel.org,
torvalds@osdl.org, akpm@osdl.org
Subject: Re: [PATCH] Eliminate thousands of warnings in WARN_ON with gcc 3.2 build
Date: Thu, 23 Apr 2009 14:02:19 +0200 [thread overview]
Message-ID: <20090423120219.GA23479@cmpxchg.org> (raw)
In-Reply-To: <20090422221134.GA1753@basil.nowhere.org>
Hi Andi,
On Thu, Apr 23, 2009 at 12:11:34AM +0200, Andi Kleen wrote:
> Eliminate thousands of warnings with gcc 3.2 build
>
> When building with gcc 3.2 I get thousands of warnings about passing
> a NULL format string to warn_on_slowpath(). Split this case out
> into a separate call. This should also shrink the kernel
> slightly in theory (haven't done numbers)
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
>
> ---
> include/asm-generic/bug.h | 7 ++++---
> kernel/panic.c | 12 +++++++++---
> 2 files changed, 13 insertions(+), 6 deletions(-)
>
> Index: linux-2.6.30-rc2-ak/include/asm-generic/bug.h
> ===================================================================
> --- linux-2.6.30-rc2-ak.orig/include/asm-generic/bug.h 2009-01-11 20:20:40.000000000 +0100
> +++ linux-2.6.30-rc2-ak/include/asm-generic/bug.h 2009-04-22 23:52:48.000000000 +0200
> @@ -58,12 +58,13 @@
> */
> #ifndef __WARN
> #ifndef __ASSEMBLY__
> -extern void warn_slowpath(const char *file, const int line,
> +extern void warn_slowpath_fmt(const char *file, const int line,
> const char *fmt, ...) __attribute__((format(printf, 3, 4)));
> +extern void warn_slowpath_null(const char *file, const int line);
> #define WANT_WARN_ON_SLOWPATH
> #endif
> -#define __WARN() warn_slowpath(__FILE__, __LINE__, NULL)
> -#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg)
> +#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
> +#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
> #else
> #define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
> #endif
> Index: linux-2.6.30-rc2-ak/kernel/panic.c
> ===================================================================
> --- linux-2.6.30-rc2-ak.orig/kernel/panic.c 2009-04-19 19:29:07.000000000 +0200
> +++ linux-2.6.30-rc2-ak/kernel/panic.c 2009-04-22 23:53:55.000000000 +0200
> @@ -342,7 +342,7 @@
> }
>
> #ifdef WANT_WARN_ON_SLOWPATH
> -void warn_slowpath(const char *file, int line, const char *fmt, ...)
> +void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
> {
> va_list args;
> char function[KSYM_SYMBOL_LEN];
> @@ -358,7 +358,7 @@
> if (board)
> printk(KERN_WARNING "Hardware name: %s\n", board);
>
> - if (fmt) {
> + if (*fmt) {
> va_start(args, fmt);
> vprintk(fmt, args);
> va_end(args);
> @@ -369,7 +369,13 @@
> print_oops_end_marker();
> add_taint(TAINT_WARN);
> }
> -EXPORT_SYMBOL(warn_slowpath);
> +EXPORT_SYMBOL(warn_slowpath_fmt);
> +
> +void warn_slowpath_null(const char *file, int line)
> +{
> + warn_slowpath_fmt(file, line, "");
> +}
> +EXPORT_SYMBOL(warn_slowpath_null);
That should still emit a warning due to passing in a zero-length
format string. Using (const char *){ 0 } as the literal would
suppress it (on gcc 4.3.3 at least) but I'm not sure if it's worth the
uglyness...
next prev parent reply other threads:[~2009-04-23 12:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-22 22:11 [PATCH] Eliminate thousands of warnings in WARN_ON with gcc 3.2 build Andi Kleen
2009-04-23 11:58 ` Jesper Nilsson
2009-04-23 12:18 ` Andi Kleen
2009-04-23 12:02 ` Johannes Weiner [this message]
2009-04-23 12:23 ` Andi Kleen
2009-04-23 14:38 ` Johannes Weiner
2009-04-23 15:10 ` Andi Kleen
2009-04-23 15:07 ` Arjan van de Ven
2009-04-23 15:23 ` Andi Kleen
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=20090423120219.GA23479@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@osdl.org \
--cc=andi@firstfloor.org \
--cc=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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