public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 1/2] realtime: Use offsetof() macro from <stddef.h>
@ 2024-07-11 10:43 Petr Vorel
  2024-07-11 10:43 ` [LTP] [RFC PATCH 2/2] sched_football: Rewrite into new API Petr Vorel
  2024-07-12  9:57 ` [LTP] [RFC PATCH 1/2] realtime: Use offsetof() macro from <stddef.h> Cyril Hrubis
  0 siblings, 2 replies; 13+ messages in thread
From: Petr Vorel @ 2024-07-11 10:43 UTC (permalink / raw)
  To: ltp; +Cc: John Stultz

offsetof() macro from <stddef.h> which uses __builtin_offsetof() should
be equivalent to the LTP custom implementation.

The replacement is required due sched_football.c rewrite into new API
(LTP library uses <stddef.h>, thus there is a redefinition).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/realtime/include/list.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/realtime/include/list.h b/testcases/realtime/include/list.h
index f87d602e4a..01159e34fc 100644
--- a/testcases/realtime/include/list.h
+++ b/testcases/realtime/include/list.h
@@ -39,6 +39,8 @@
 #ifndef _LINUX_LIST_H
 #define _LINUX_LIST_H
 
+#include <stddef.h>
+
 /*
  * These are non-NULL pointers that will result in page faults
  * under normal circumstances, used to verify that nobody uses
@@ -241,7 +243,6 @@ static inline void list_splice_init(struct list_head *list,
 	}
 }
 
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:	the pointer to the member.
-- 
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2024-07-17 16:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 10:43 [LTP] [RFC PATCH 1/2] realtime: Use offsetof() macro from <stddef.h> Petr Vorel
2024-07-11 10:43 ` [LTP] [RFC PATCH 2/2] sched_football: Rewrite into new API Petr Vorel
2024-07-12 11:21   ` Cyril Hrubis
2024-07-12 13:22     ` Petr Vorel
2024-07-12 14:11       ` Cyril Hrubis
2024-07-12 19:09         ` Petr Vorel
2024-07-15  9:07           ` Cyril Hrubis
2024-07-15  9:52             ` Petr Vorel
2024-07-15 10:38               ` Cyril Hrubis
2024-07-15 12:44                 ` Petr Vorel
2024-07-17 14:52   ` Cyril Hrubis
2024-07-17 16:03     ` Petr Vorel
2024-07-12  9:57 ` [LTP] [RFC PATCH 1/2] realtime: Use offsetof() macro from <stddef.h> Cyril Hrubis

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