Commit 8b2a1fd1 authored by Zach Brown's avatar Zach Brown Committed by Linus Torvalds

[PATCH] pr_debug: check pr_debug() arguments

check pr_debug() arguments

When DEBUG isn't defined pr_debug() is defined away as an empty macro.  By
throwing away the arguments we allow completely incorrect code to build.

Instead let's make it an empty inline which checks arguments and mark it so gcc
can check the format specification.

This results in a seemingly insignificant code size increase.  A x86-64
allyesconfig:

   text    data     bss     dec     hex filename
25354768        7191098 4854720 37400586        23ab00a vmlinux.before
25354945        7191138 4854720 37400803        23ab0e3 vmlinux
Signed-off-by: default avatarZach Brown <zach.brown@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3879b6b6
...@@ -216,8 +216,10 @@ extern void dump_stack(void); ...@@ -216,8 +216,10 @@ extern void dump_stack(void);
#define pr_debug(fmt,arg...) \ #define pr_debug(fmt,arg...) \
printk(KERN_DEBUG fmt,##arg) printk(KERN_DEBUG fmt,##arg)
#else #else
#define pr_debug(fmt,arg...) \ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
do { } while (0) {
return 0;
}
#endif #endif
#define pr_info(fmt,arg...) \ #define pr_info(fmt,arg...) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment