Messages in this thread Patch in this message |  | | From | Linus Torvalds <> | Date | Mon, 9 Apr 2018 10:14:25 -0700 | Subject | Re: [bisected] 3c8ba0d61d04ced9f8d9ff93977995a9e4e96e91 oopses on s390 |
| |
On Mon, Apr 9, 2018 at 10:03 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote: > > Our old "min()" had the internal variables called "min1" and "min2", > which is crazy too.
Actually, no, it used the really cumbersome "__UNIQUE_ID" and then passed that odd as the name 'min1/2',
Ugh, I find that really nasty to read, but it was obviously done because we hit this before.
And our __UNIQUE_ID() macro is garbage anyway, since it falls back on the line number, which doesn't really work for macros anyway. But we have proper macros for both clang and gcc, so maybe we should ignore the broken fallback.
A patch like the attached, perhaps?
Linus include/linux/kernel.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4ae1dfd9bf05..52b70894eaa5 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -822,14 +822,15 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #define __cmp(x, y, op) ((x) op (y) ? (x) : (y)) -#define __cmp_once(x, y, op) ({ \ - typeof(x) __x = (x); \ - typeof(y) __y = (y); \ - __cmp(__x, __y, op); }) - -#define __careful_cmp(x, y, op) \ - __builtin_choose_expr(__safe_cmp(x, y), \ - __cmp(x, y, op), __cmp_once(x, y, op)) +#define __cmp_once(x, y, unique_x, unique_y, op) ({ \ + typeof(x) unique_x = (x); \ + typeof(y) unique_y = (y); \ + __cmp(unique_x, unique_y, op); }) + +#define __careful_cmp(x, y, op) \ + __builtin_choose_expr(__safe_cmp(x, y), \ + __cmp(x, y, op), \ + __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op)) /** * min - return minimum of two values of the same or compatible types |  |