[PATCH:xserver] Fix uninitialized variable warnings reported by clang. (was Re: [PATCH:xf86-video-ati] Fix uninitialized variable warnings reported by clang.)

Thomas Klausner wiz at NetBSD.org
Tue Dec 15 23:36:24 PST 2015


On Wed, Dec 16, 2015 at 10:24:39AM +0900, Michel Dänzer wrote:
> Yes, but the xorg_list_for_each_entry macro needs the same treatment.
> With that,
> 
> Acked-by: Michel Dänzer <michel.daenzer at amd.com>

Thanks, new version attached.
 Thomas
-------------- next part --------------
>From c6452b3bc84e2995cb8ef7b45bc239c0393a5552 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Tue, 15 Dec 2015 11:03:39 +0100
Subject: [PATCH:xserver 3/3] Fix uninitialized variable warnings reported by
 clang.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
Acked-by: Michel Dänzer <michel.daenzer at amd.com>
---
 include/list.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/list.h b/include/list.h
index 39f1985..1accf10 100644
--- a/include/list.h
+++ b/include/list.h
@@ -304,7 +304,8 @@ xorg_list_is_empty(struct xorg_list *head)
  * @param member Member name of the struct xorg_list in the list elements.
  *
  */
-#define xorg_list_for_each_entry(pos, head, member)				\
+#define xorg_list_for_each_entry(pos, head, member)			\
+    pos = NULL;								\
     for (pos = __container_of((head)->next, pos, member);		\
 	 &pos->member != (head);					\
 	 pos = __container_of(pos->member.next, pos, member))
@@ -317,6 +318,7 @@ xorg_list_is_empty(struct xorg_list *head)
  * See xorg_list_for_each_entry for more details.
  */
 #define xorg_list_for_each_entry_safe(pos, tmp, head, member)		\
+    pos = NULL;								\
     for (pos = __container_of((head)->next, pos, member),		\
 	 tmp = __container_of(pos->member.next, pos, member);		\
 	 &pos->member != (head);					\
-- 
2.6.4



More information about the xorg-devel mailing list