Re: [PATCH] Fix warnings from gcc 4.1.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sat, 8 Jul 2006, Linus Torvalds wrote:
> 
> Please send a bug-report to the gcc people instead.
> 
> The code is correct, and the warning is bogus.

Ahhah.

I figured out a way to get gcc to not complain about it.

Making it a statement expression shuts gcc up about the unused result.

Damn gcc. But this patch _should_ fix things... (it also fixes 
"add_pseudo()" to return the proper type rather than silently drop the 
type information on the floor with "void *").

Does this silence the bogus compiler warnings for you?

		Linus

----
diff --git a/linearize.h b/linearize.h
index 5f021a3..66a76dc 100644
--- a/linearize.h
+++ b/linearize.h
@@ -237,7 +237,7 @@ static inline void add_multijmp(struct m
 	add_ptr_list(list, multijmp);
 }
 
-static inline void *add_pseudo(struct pseudo_list **list, struct pseudo *pseudo)
+static inline pseudo_t *add_pseudo(struct pseudo_list **list, pseudo_t pseudo)
 {
 	return add_ptr_list(list, pseudo);
 }
diff --git a/ptrlist.h b/ptrlist.h
index b42a0ca..719f437 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -15,6 +15,7 @@ #define DECLARE_PTR_LIST(listname,type)	
 #define CHECK_TYPE(head,ptr)		(void)(&(ptr) == &(head)->list[0])
 #define TYPEOF(head)			__typeof__(&(head)->list[0])
 #define VRFY_PTR_LIST(head)		(void)(sizeof((head)->list[0]))
+#define MKTYPE(head,expr)		({ (TYPEOF(head))(expr); })
 
 #define LIST_NODE_NR (29)
 
@@ -46,7 +47,7 @@ extern int linearize_ptr_list(struct ptr
  * extensions..
  */
 #define add_ptr_list_tag(list,entry,tag) \
-	(TYPEOF(*(list))) (CHECK_TYPE(*(list),(entry)),__add_ptr_list((struct ptr_list **)(list), (entry), (tag)))
+	MKTYPE(*(list), (CHECK_TYPE(*(list),(entry)),__add_ptr_list((struct ptr_list **)(list), (entry), (tag))))
 #define add_ptr_list(list,entry) \
 	add_ptr_list_tag(list,entry,0)
 #define free_ptr_list(list) \
-
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

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux