diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-08-02 22:44:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-24 09:20:01 +0300 |
commit | c6e3c12ff9fba32f1833b730a052f4b0a49a403d (patch) | |
tree | 40862929c3413752be9c75359530ea9d83cd3b9d /include | |
parent | 03ba86bb381114a4bbbcb4a700c1e9f085c336c9 (diff) | |
download | linux-c6e3c12ff9fba32f1833b730a052f4b0a49a403d.tar.xz |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/trace/trace_events.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index d74c076e9e2b..717d388ecbd6 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -400,7 +400,7 @@ static struct trace_event_functions trace_event_type_funcs_##call = { \ #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) -#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) +#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) #undef __field_ext #define __field_ext(_type, _item, _filter_type) { \ |