linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] add typeof_member() macro
@ 2019-05-29 19:07 Alexey Dobriyan
  2019-05-29 19:11 ` [PATCH 2/2] proc: use " Alexey Dobriyan
  2019-05-30 11:37 ` [PATCH 1/2] add " David Laight
  0 siblings, 2 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2019-05-29 19:07 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Add typeof_member() macro so that types can be exctracted without
introducing dummy variables.

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

 include/linux/kernel.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -88,6 +88,8 @@
  */
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 
+#define typeof_member(T, m)	typeof(((T*)0)->m)
+
 #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
 
 #define DIV_ROUND_DOWN_ULL(ll, d) \

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

end of thread, other threads:[~2019-05-30 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 19:07 [PATCH 1/2] add typeof_member() macro Alexey Dobriyan
2019-05-29 19:11 ` [PATCH 2/2] proc: use " Alexey Dobriyan
2019-05-29 22:33   ` Andrew Morton
2019-05-30 11:37 ` [PATCH 1/2] add " David Laight
2019-05-30 11:53   ` Joe Perches
2019-05-30 19:57   ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).