Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Add a dummy printk function for the maintenance of unused printks

Add a dummy printk function for the maintenance of unused printks through gcc
format checking, and also so that side-effect checking is maintained too.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Howells and committed by
Linus Torvalds
12fdff3f 1490cf5f

+22 -54
-5
arch/mn10300/kernel/mn10300-serial.c
··· 44 44 #include <unit/timex.h> 45 45 #include "mn10300-serial.h" 46 46 47 - static inline __attribute__((format(printf, 1, 2))) 48 - void no_printk(const char *fmt, ...) 49 - { 50 - } 51 - 52 47 #define kenter(FMT, ...) \ 53 48 printk(KERN_DEBUG "-->%s(" FMT ")\n", __func__, ##__VA_ARGS__) 54 49 #define _enter(FMT, ...) \
+3 -9
fs/afs/internal.h
··· 752 752 #define dbgprintk(FMT,...) \ 753 753 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__) 754 754 755 - /* make sure we maintain the format strings, even when debugging is disabled */ 756 - static inline __attribute__((format(printf,1,2))) 757 - void _dbprintk(const char *fmt, ...) 758 - { 759 - } 760 - 761 755 #define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 762 756 #define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 763 757 #define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__) ··· 786 792 } while (0) 787 793 788 794 #else 789 - #define _enter(FMT,...) _dbprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 790 - #define _leave(FMT,...) _dbprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 791 - #define _debug(FMT,...) _dbprintk(" "FMT ,##__VA_ARGS__) 795 + #define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 796 + #define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 797 + #define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__) 792 798 #endif 793 799 794 800 /*
+3 -10
fs/cachefiles/internal.h
··· 267 267 #define dbgprintk(FMT, ...) \ 268 268 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 269 269 270 - /* make sure we maintain the format strings, even when debugging is disabled */ 271 - static inline void _dbprintk(const char *fmt, ...) 272 - __attribute__((format(printf, 1, 2))); 273 - static inline void _dbprintk(const char *fmt, ...) 274 - { 275 - } 276 - 277 270 #define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 278 271 #define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 279 272 #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) ··· 297 304 } while (0) 298 305 299 306 #else 300 - #define _enter(FMT, ...) _dbprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 301 - #define _leave(FMT, ...) _dbprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 302 - #define _debug(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 307 + #define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__) 308 + #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 309 + #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 303 310 #endif 304 311 305 312 #if 1 /* defined(__KDEBUGALL) */
+4 -10
fs/fscache/internal.h
··· 321 321 #define dbgprintk(FMT, ...) \ 322 322 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 323 323 324 - /* make sure we maintain the format strings, even when debugging is disabled */ 325 - static inline __attribute__((format(printf, 1, 2))) 326 - void _dbprintk(const char *fmt, ...) 327 - { 328 - } 329 - 330 324 #define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 331 325 #define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 332 326 #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) 333 327 334 - #define kjournal(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 328 + #define kjournal(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 335 329 336 330 #ifdef __KDEBUG 337 331 #define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__) ··· 352 358 } while (0) 353 359 354 360 #else 355 - #define _enter(FMT, ...) _dbprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 356 - #define _leave(FMT, ...) _dbprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 357 - #define _debug(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 361 + #define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__) 362 + #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 363 + #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__) 358 364 #endif 359 365 360 366 /*
+7
include/linux/kernel.h
··· 306 306 } 307 307 #endif 308 308 309 + /* 310 + * Dummy printk for disabled debugging statements to use whilst maintaining 311 + * gcc's format and side-effect checking. 312 + */ 313 + static inline __attribute__ ((format (printf, 1, 2))) 314 + int no_printk(const char *s, ...) { return 0; } 315 + 309 316 extern int printk_needs_cpu(int cpu); 310 317 extern void printk_tick(void); 311 318
-4
kernel/cred.c
··· 22 22 #define kdebug(FMT, ...) \ 23 23 printk("[%-5.5s%5u] "FMT"\n", current->comm, current->pid ,##__VA_ARGS__) 24 24 #else 25 - static inline __attribute__((format(printf, 1, 2))) 26 - void no_printk(const char *fmt, ...) 27 - { 28 - } 29 25 #define kdebug(FMT, ...) \ 30 26 no_printk("[%-5.5s%5u] "FMT"\n", current->comm, current->pid ,##__VA_ARGS__) 31 27 #endif
+5 -11
net/rxrpc/ar-internal.h
··· 597 597 #define dbgprintk(FMT,...) \ 598 598 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__) 599 599 600 - /* make sure we maintain the format strings, even when debugging is disabled */ 601 - static inline __attribute__((format(printf,1,2))) 602 - void _dbprintk(const char *fmt, ...) 603 - { 604 - } 605 - 606 600 #define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 607 601 #define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 608 602 #define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__) ··· 649 655 } while (0) 650 656 651 657 #else 652 - #define _enter(FMT,...) _dbprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 653 - #define _leave(FMT,...) _dbprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 654 - #define _debug(FMT,...) _dbprintk(" "FMT ,##__VA_ARGS__) 655 - #define _proto(FMT,...) _dbprintk("### "FMT ,##__VA_ARGS__) 656 - #define _net(FMT,...) _dbprintk("@@@ "FMT ,##__VA_ARGS__) 658 + #define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 659 + #define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 660 + #define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__) 661 + #define _proto(FMT,...) no_printk("### "FMT ,##__VA_ARGS__) 662 + #define _net(FMT,...) no_printk("@@@ "FMT ,##__VA_ARGS__) 657 663 #endif 658 664 659 665 /*
-5
security/keys/internal.h
··· 15 15 #include <linux/sched.h> 16 16 #include <linux/key-type.h> 17 17 18 - static inline __attribute__((format(printf, 1, 2))) 19 - void no_printk(const char *fmt, ...) 20 - { 21 - } 22 - 23 18 #ifdef __KDEBUG 24 19 #define kenter(FMT, ...) \ 25 20 printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)