Make sure developer build fails when finding uninitialized variable
Alexander Bokovoy
ab at samba.org
Tue Feb 24 06:17:35 MST 2015
Hi,
following Jeremy's thought[1] on failing a build when there is
uninitialized variable in the code, here is a first patch:
make sure developer build would fail with an error for -Wuninitialized.
[1] https://lwn.net/Articles/634505/
--
/ Alexander Bokovoy
-------------- next part --------------
>From 82cfdc9dd9270fb9ea4a815f3fb545a8385bab74 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <ab at samba.org>
Date: Tue, 24 Feb 2015 15:12:39 +0200
Subject: [PATCH] wafsamba: make sure build fails when uninitialized variable
is detected
In developer build, fail if uninitialized variable is found by GCC.
---
buildtools/wafsamba/samba_autoconf.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index c13bfe7..905adc7 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -677,6 +677,8 @@ def SAMBA_CONFIG_H(conf, path=None):
testflags=True)
conf.ADD_CFLAGS('-Werror=return-type -Wreturn-type',
testflags=True)
+ conf.ADD_CFLAGS('-Werror=uninitialized -Wuninitialized',
+ testflags=True)
conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True)
# This check is because for ldb_search(), a NULL format string
--
2.1.0
More information about the samba-technical
mailing list