[ccan] [PATCH 3/3] bytestring: avoid compile_fail failure due to uninitialized warning

Cody P Schafer dev at codyps.com
Tue Aug 18 10:33:31 AEST 2015


bytestring: Module tests compile (tests_compile): FAIL
/home/x/g/ccc/ccan/ccan/bytestring/test/compile_fail-BYTESTRING-2.c:Compile gave warnings without -DFAIL:
/home/x/g/ccc/ccan/ccan/bytestring/test/compile_fail-BYTESTRING-2.c: In function ‘main’:
/home/x/g/ccc/ccan/ccan/bytestring/test/compile_fail-BYTESTRING-2.c:15:2: warning: ‘bs.len’ is used uninitialized in this function [-Wuninitialized]
  printf("%zd %s\n", bs.len, x);
  ^

Signed-off-by: Cody P Schafer <dev at codyps.com>
---
 ccan/bytestring/test/compile_fail-BYTESTRING-2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ccan/bytestring/test/compile_fail-BYTESTRING-2.c b/ccan/bytestring/test/compile_fail-BYTESTRING-2.c
index 3c62f94..87dd7c7 100644
--- a/ccan/bytestring/test/compile_fail-BYTESTRING-2.c
+++ b/ccan/bytestring/test/compile_fail-BYTESTRING-2.c
@@ -11,6 +11,8 @@ int main(int argc, char *argv[])
 
 #ifdef FAIL
 	bs = BYTESTRING(x);
+#else
+	bs.len = 0;
 #endif
 	printf("%zd %s\n", bs.len, x);
 	return 0;
-- 
2.5.0



More information about the ccan mailing list