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

Configure Feed

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

bug: Clean up CONFIG_GENERIC_BUG_RELATIVE_POINTERS

Three repeated CONFIG_GENERIC_BUG_RELATIVE_POINTERS #ifdefs right
after one another yields unreadable code. Add a helper.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115757.341703850@infradead.org

+9 -15
+9 -15
include/asm-generic/bug.h
··· 35 35 36 36 #ifdef CONFIG_BUG 37 37 38 + #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 39 + #define BUG_REL(type, name) type name 40 + #else 41 + #define BUG_REL(type, name) signed int name##_disp 42 + #endif 43 + 38 44 #ifdef CONFIG_GENERIC_BUG 39 45 struct bug_entry { 40 - #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 41 - unsigned long bug_addr; 42 - #else 43 - signed int bug_addr_disp; 44 - #endif 46 + BUG_REL(unsigned long, bug_addr); 45 47 #ifdef HAVE_ARCH_BUG_FORMAT 46 - #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 47 - const char *format; 48 - #else 49 - signed int format_disp; 50 - #endif 48 + BUG_REL(const char *, format); 51 49 #endif 52 50 #ifdef CONFIG_DEBUG_BUGVERBOSE 53 - #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 54 - const char *file; 55 - #else 56 - signed int file_disp; 57 - #endif 51 + BUG_REL(const char *, file); 58 52 unsigned short line; 59 53 #endif 60 54 unsigned short flags;