On 05/10/2018 09:38, Daniel Hellstrom wrote:

On 2018-10-05 09:34, Sebastian Huber wrote:
On 05/10/2018 09:25, Daniel Hellstrom wrote:
On 2018-10-05 09:12, Sebastian Huber wrote:
On 05/10/2018 08:57, Daniel Hellstrom wrote:
This fixes the following test failures on LEON3 UP/SMP when
built using clang compiler:
  * fsjffs2gc01
  * jffs2_fserror
  * jffs2_fspermission
  * jffs2_fsrdwr
  * jffs2_fstime

The problem is probably in the rbtree_postorder_for_each_entry_safe(). Coverity Scan has also an issue with this macro. It is on my todo list. Please do not check in this patch.
Ok I will not push it. Yes I was also thinking so. To use offsetof() macro could be an option maybe, however the node type input is not known to the rbtree_postorder_for_each_entry_safe() function even though it only used from jffs2 code.

The Linux code uses typeof. We could do this also:

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 \
     ); \

It shouldn't be a big problem since at least GCC and clang supports it. It is also a standard C++ operator. It is already used in

cpukit/libfs/src/jffs2/include/linux/list.h

Ok, I will give it a try.


Thanks, please try this patch:

https://lists.rtems.org/pipermail/devel/2018-October/023181.html

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to