aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2009-05-06 19:02:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-06 19:36:09 -0400
commit57adc4d2dbf968fdbe516359688094eef4d46581 (patch)
tree69e84c0feb47f0d6b677266d12635f54636528d7
parent429aa0fca0df702fc9c81d799175a7d920398827 (diff)
Eliminate thousands of warnings with gcc 3.2 build
When building with gcc 3.2 I get thousands of warnings such as include/linux/gfp.h: In function `allocflags_to_migratetype': include/linux/gfp.h:105: warning: null format string due to passing a NULL format string to warn_slowpath() in #define __WARN() warn_slowpath(__FILE__, __LINE__, NULL) Split this case out into a separate call. This also shrinks the kernel slightly: text data bss dec hex filename 4802274 707668 712704 6222646 5ef336 vmlinux text data bss dec hex filename 4799027 703572 712704 6215303 5ed687 vmlinux due to removeing one argument from the commonly-called __WARN(). [akpm@linux-foundation.org: reduce scope of `empty'] Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/asm-generic/bug.h7
-rw-r--r--kernel/panic.c13
2 files changed, 14 insertions, 6 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index e727fe0d1451..4b6755984d24 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -58,12 +58,13 @@ struct bug_entry {
58 */ 58 */
59#ifndef __WARN 59#ifndef __WARN
60#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
61extern void warn_slowpath(const char *file, const int line, 61extern void warn_slowpath_fmt(const char *file, const int line,
62 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 62 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
63extern void warn_slowpath_null(const char *file, const int line);
63#define WANT_WARN_ON_SLOWPATH 64#define WANT_WARN_ON_SLOWPATH
64#endif 65#endif
65#define __WARN() warn_slowpath(__FILE__, __LINE__, NULL) 66#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
66#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) 67#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
67#else 68#else
68#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 69#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
69#endif 70#endif
diff --git a/kernel/panic.c b/kernel/panic.c
index 3dcaa1661357..874ecf1307ae 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -340,7 +340,7 @@ void oops_exit(void)
340} 340}
341 341
342#ifdef WANT_WARN_ON_SLOWPATH 342#ifdef WANT_WARN_ON_SLOWPATH
343void warn_slowpath(const char *file, int line, const char *fmt, ...) 343void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
344{ 344{
345 va_list args; 345 va_list args;
346 char function[KSYM_SYMBOL_LEN]; 346 char function[KSYM_SYMBOL_LEN];
@@ -356,7 +356,7 @@ void warn_slowpath(const char *file, int line, const char *fmt, ...)
356 if (board) 356 if (board)
357 printk(KERN_WARNING "Hardware name: %s\n", board); 357 printk(KERN_WARNING "Hardware name: %s\n", board);
358 358
359 if (fmt) { 359 if (*fmt) {
360 va_start(args, fmt); 360 va_start(args, fmt);
361 vprintk(fmt, args); 361 vprintk(fmt, args);
362 va_end(args); 362 va_end(args);
@@ -367,7 +367,14 @@ void warn_slowpath(const char *file, int line, const char *fmt, ...)
367 print_oops_end_marker(); 367 print_oops_end_marker();
368 add_taint(TAINT_WARN); 368 add_taint(TAINT_WARN);
369} 369}
370EXPORT_SYMBOL(warn_slowpath); 370EXPORT_SYMBOL(warn_slowpath_fmt);
371
372void warn_slowpath_null(const char *file, int line)
373{
374 static const char *empty = "";
375 warn_slowpath_fmt(file, line, empty);
376}
377EXPORT_SYMBOL(warn_slowpath_null);
371#endif 378#endif
372 379
373#ifdef CONFIG_CC_STACKPROTECTOR 380#ifdef CONFIG_CC_STACKPROTECTOR