Skip to content

Commit 09794a5

Browse files
committed
tracing: Use alignof__(struct {type b;}) instead of offsetof()
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/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Suggested-by: David Laight <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 2f63e5d commit 09794a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/trace/stages/stage4_event_fields.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/* Stage 4 definitions for creating trace events */
44

5-
#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b)))
5+
#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;})))
66

77
#undef __field_ext
88
#define __field_ext(_type, _item, _filter_type) { \

0 commit comments

Comments
 (0)