keyboard stuff
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Tidy up print/debug logging headers (#22969)

authored by

Joel Challis and committed by
GitHub
bb711456 f2299ee5

+20 -49
-7
platforms/avr/_print.h
··· 24 24 #pragma once 25 25 26 26 #include "avr/xprintf.h" 27 - 28 - // Create user & normal print defines 29 - #define print(s) xputs(PSTR(s)) 30 - #define println(s) xputs(PSTR(s "\r\n")) 31 - #define uprint(s) xputs(PSTR(s)) 32 - #define uprintln(s) xputs(PSTR(s "\r\n")) 33 - #define uprintf(fmt, ...) __xprintf(PSTR(fmt), ##__VA_ARGS__)
+7 -19
quantum/logging/debug.h
··· 54 54 * Debug print utils 55 55 */ 56 56 #ifndef NO_DEBUG 57 - 58 - # define dprint(s) \ 59 - do { \ 60 - if (debug_enable) print(s); \ 61 - } while (0) 62 - # define dprintln(s) \ 63 - do { \ 64 - if (debug_enable) println(s); \ 65 - } while (0) 66 - # define dprintf(fmt, ...) \ 67 - do { \ 68 - if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \ 57 + # define dprintf(fmt, ...) \ 58 + do { \ 59 + if (debug_config.enable) xprintf(fmt, ##__VA_ARGS__); \ 69 60 } while (0) 70 - # define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s) 71 - 72 61 #else /* NO_DEBUG */ 73 - 74 - # define dprint(s) 75 - # define dprintln(s) 76 62 # define dprintf(fmt, ...) 77 - # define dmsg(s) 63 + #endif /* NO_DEBUG */ 78 64 79 - #endif /* NO_DEBUG */ 65 + #define dprint(s) dprintf(s) 66 + #define dprintln(s) dprintf(s "\r\n") 67 + #define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)
+13 -23
quantum/logging/print.h
··· 52 52 # if __has_include_next("_print.h") 53 53 # include_next "_print.h" /* Include the platforms print.h */ 54 54 # else 55 - // Fall back to lib/printf 56 - # include "printf.h" // lib/printf/printf.h 57 - 58 - // Create user & normal print defines 59 - # define print(s) printf(s) 60 - # define println(s) printf(s "\r\n") 55 + # include "printf.h" // // Fall back to lib/printf/printf.h 61 56 # define xprintf printf 62 - # define uprint(s) printf(s) 63 - # define uprintln(s) printf(s "\r\n") 64 - # define uprintf printf 65 - 66 - # endif /* __has_include_next("_print.h") */ 67 - #else /* NO_PRINT */ 68 - # undef xprintf 57 + # endif 58 + #else 69 59 // Remove print defines 70 - # define print(s) 71 - # define println(s) 60 + # undef xprintf 72 61 # define xprintf(fmt, ...) 73 - # define uprintf(fmt, ...) 74 - # define uprint(s) 75 - # define uprintln(s) 62 + #endif 76 63 77 - #endif /* NO_PRINT */ 64 + // Resolve before USER_PRINT can remove 65 + #define uprintf xprintf 78 66 79 67 #ifdef USER_PRINT 80 68 // Remove normal print defines 81 - # undef print 82 - # undef println 83 69 # undef xprintf 84 - # define print(s) 85 - # define println(s) 86 70 # define xprintf(fmt, ...) 87 71 #endif 72 + 73 + #define print(s) xprintf(s) 74 + #define println(s) xprintf(s "\r\n") 88 75 89 76 #define print_dec(i) xprintf("%u", i) 90 77 #define print_decs(i) xprintf("%d", i) ··· 120 107 // print (and store their wasteful strings). 121 108 // 122 109 // !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!! 110 + 111 + #define uprint(s) uprintf(s) 112 + #define uprintln(s) uprintf(s "\r\n") 123 113 124 114 /* decimal */ 125 115 #define uprint_dec(i) uprintf("%u", i)