tracing: Use alignof__(struct {type b;}) instead of offsetof()
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 2 Aug 2022 19:44:12 +0000 (15:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:22:48 +0000 (07:22 +0100)
commit487a086595b5282fe050da1803cccf7b75022d5e
tree44c58391c70b2e16b2d18736b8486418c00db0d1
parent430443f8565ea4495018491ade71abd2bd520324
tracing: Use alignof__(struct {type b;}) instead of offsetof()

commit 09794a5a6c348f629b35fc1687071a1622ef4265 upstream.

Simplify:

  #define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b)))

with

  #define  ALIGN_STRUCTFIELD(type) __alignof__(struct {type b;})

Which works just the same.

Link: https://lore.kernel.org/all/a7d202457150472588df0bd3b7334b3f@AcuMS.aculab.com/
Link: https://lkml.kernel.org/r/20220802154412.513c50e3@gandalf.local.home
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/trace/trace_events.h