]> git.ozlabs.org Git - ccan/commitdiff
cdump: fix uninitialized warning with optimization
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 25 Oct 2016 04:07:00 +0000 (14:37 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 25 Oct 2016 04:07:00 +0000 (14:37 +1030)
/home/rusty/devel/cvs/ccan/ccan/cdump/cdump.c: In function ‘get_type’:
/home/rusty/devel/cvs/ccan/ccan/strmap/strmap.h:88:39: warning: ‘m’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  tcon_cast((map), canary, strmap_get_(&(map)->raw, (member)))
                                       ^
/home/rusty/devel/cvs/ccan/ccan/cdump/cdump.c:216:20: note: ‘m’ was declared here
  cdump_map_t *m;
               ^

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/cdump/cdump.c

index 85c818a6df7508db2365efaa952366daa11f8af5..7e42dbd74dc6d328186680598a6b364b2c957bb9 100644 (file)
@@ -213,7 +213,7 @@ static struct cdump_type *get_type(struct cdump_definitions *defs,
                                   enum cdump_type_kind kind,
                                   const char *name)
 {
-       cdump_map_t *m;
+       cdump_map_t *m = (void *)0x1L; /* Shouldn't be used */
        struct cdump_type *t;
 
        switch (kind) {