[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH v2 3/7] xen/list: address violations of MISRA C Rule 20.7
On 2024-03-11 08:48, Jan Beulich wrote: On 08.03.2024 12:21, Nicola Vetrini wrote:--- a/xen/include/xen/list.h +++ b/xen/include/xen/list.h@@ -479,9 +479,9 @@ static inline void list_splice_init(struct list_head *list,* @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_backwards_safe(pos, n, head) \ - for ( pos = (head)->prev, n = pos->prev; pos != (head); \ - pos = n, n = pos->prev ) +#define list_for_each_backwards_safe(pos, n, head) \ + for ( (pos) = (head)->prev, n = (pos)->prev; (pos) != (head); \ + (pos) = n, n = (pos)->prev )I think this is worse than before and incomplete: At least the rhs use of nalso needs parenthesizing. Plus if pos is parenthesized even in lhs instances, imo n ought to be, too. You are right: this was simply an oversight. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |