The macros add_ptr_lis() & add_ptr_list_tag() have a rather complex and long definition. Make them more readable by splittign the long definition in three separate lines, inside a statement expression. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- ptrlist.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ptrlist.h b/ptrlist.h index e01edd1c3..cb3e989a3 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -14,13 +14,6 @@ #define TYPEOF(head) __typeof__(&(head)->list[0]) #define VRFY_PTR_LIST(head) (void)(sizeof((head)->list[0])) -/* - * The "unnecessary" statement expression is there to shut up a totally - * bogus gcc warning about unused expressions, brought on by the fact - * that we cast the result to the proper type. - */ -#define MKTYPE(head,expr) ({ (TYPEOF(head))(expr); }) - #define LIST_NODE_NR (13) #define DECLARE_PTR_LIST(listname, type) \ @@ -55,10 +48,16 @@ extern int linearize_ptr_list(struct ptr_list *, void **, int); * You just have to be creative, and use some gcc * extensions.. */ -#define add_ptr_list_tag(list,entry,tag) \ - MKTYPE(*(list), (CHECK_TYPE(*(list),(entry)),__add_ptr_list_tag((struct ptr_list **)(list), (entry), (tag)))) -#define add_ptr_list(list,entry) \ - MKTYPE(*(list), (CHECK_TYPE(*(list),(entry)),__add_ptr_list((struct ptr_list **)(list), (entry)))) +#define add_ptr_list(list, ptr) ({ \ + struct ptr_list** head = (struct ptr_list**)(list); \ + CHECK_TYPE(*(list),ptr); \ + (__typeof__(&(ptr))) __add_ptr_list(head, ptr); \ + }) +#define add_ptr_list_tag(list, ptr, tag) ({ \ + struct ptr_list** head = (struct ptr_list**)(list); \ + CHECK_TYPE(*(list),ptr); \ + (__typeof__(&(ptr))) __add_ptr_list_tag(head, ptr, tag); \ + }) #define free_ptr_list(list) \ do { VRFY_PTR_LIST(*(list)); __free_ptr_list((struct ptr_list **)(list)); } while (0) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html