[PATCH] Fix rbtree_postorder_for_each_entry_safe()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Oct 5 07:40:09 UTC 2018
Use the non-standard typeof operator to avoid code generation errors
with clang and use of uninitialized variable warnings with GCC and
Coverity Scan.
Update #3465.
---
cpukit/include/linux/rbtree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpukit/include/linux/rbtree.h b/cpukit/include/linux/rbtree.h
index 53c777e8c1..8fc575240f 100644
--- a/cpukit/include/linux/rbtree.h
+++ b/cpukit/include/linux/rbtree.h
@@ -126,12 +126,12 @@ static inline struct rb_node *rb_parent( struct rb_node *node )
for ( \
node = _RBTree_Postorder_first( \
(RBTree_Control *) root, \
- (size_t) ( (char *) &node->field - (char *) node ) \
+ offsetof( __typeof__( *node ), field ) \
); \
node != NULL && ( \
next = _RBTree_Postorder_next( \
&node->field, \
- (size_t) ( (char *) &node->field - (char *) node ) \
+ offsetof( __typeof__( *node ), field ) \
), \
node != NULL \
); \
--
2.16.4
More information about the devel
mailing list