mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] compiler.h: simplify data_race() macro
@ 2024-06-24 11:49 Alexey Dobriyan
  2024-06-24 12:27 ` Marco Elver
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey Dobriyan @ 2024-06-24 11:49 UTC (permalink / raw)
  To: Thomas Gleixner, Marco Elver; +Cc: linux-kernel, akpm

Use auto type deduction and comma expression to decrease macro expansion
size.

__unqual_scalar_typeof() is quite wordy macro by itself.

"expr" can be arbitrary complex so not expanding it twice is good.
Should be faster too because type is deduced only once
from the initializer.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/linux/compiler.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -200,10 +200,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
  */
 #define data_race(expr)							\
 ({									\
-	__unqual_scalar_typeof(({ expr; })) __v = ({			\
-		__kcsan_disable_current();				\
-		expr;							\
-	});								\
+	__auto_type __v = (__kcsan_disable_current(), expr);		\
 	__kcsan_enable_current();					\
 	__v;								\
 })

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-06-28 15:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 11:49 [PATCH] compiler.h: simplify data_race() macro Alexey Dobriyan
2024-06-24 12:27 ` Marco Elver
2024-06-24 14:37   ` Alexey Dobriyan
2024-06-24 14:41     ` Marco Elver
2024-06-24 14:42   ` Alexey Dobriyan
2024-06-24 15:09     ` Marco Elver
2024-06-24 15:39       ` [PATCH v2] " Alexey Dobriyan
2024-06-24 15:41         ` Marco Elver
2024-06-28 15:03         ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®