Hi all,

I have attached a patch that allows the OpenOCD project to use the
-Wextra and -Werror flags, providing new configuration options to
disable them (--disable-wextra and --disable-werror, respectively). 
 
In the process, I updated the help text of the gccwarnings option to
better reflect that it is normally enabled, and I made the new options
conditional upon that option being enabled (i.e. --disable-gccwarnings
implicitly passes --disable-wextra and --disable-werror).

As this suggests, I have made these the default settings; however, I
realize there may be some controversy over that decision.  Lacking the
relevant hardware and knowing there are outstanding patches, I avoided
some platform code and FTDI-based drivers for now; I can imagine others
might run into problems therein.  Perhaps others might be willing to
help finish what I have started?  Regardless, this patch seeks to
promote discussion about discipline in the development process.

If you see warnings after applying this patch (and re-bootstrapping, if
you are not using --enable-maintainer-mode), consider that I am only
testing the following subset of the configuration options:

        --enable-parport \
        --enable-dummy \
        --enable-amtjtagaccel \
        --enable-ep93xx \
        --enable-at91rm9200 \
        --enable-gw16012 \
        --enable-usbprog \
        --enable-oocd_trace \
        --enable-jlink \
        --enable-vsllink \
        --enable-rlink \
        --enable-arm-jtag-ew

While others should be able to trivially draft additional patches to fix
the warnings this patch might expose in the remaining modules, I would
be happy to take a look at fixing any problems that it creates.

Cheers,

Zach

Index: configure.in
===================================================================
--- configure.in	(revision 1471)
+++ configure.in	(working copy)
@@ -178,9 +178,18 @@
 )
 
 AC_ARG_ENABLE(gccwarnings,
-	AS_HELP_STRING([--enable-gccwarnings], [Enable compiler warnings, default yes]),
+	AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
 	[gcc_warnings=$enableval], [gcc_warnings=yes])
 
+AC_ARG_ENABLE(wextra,
+	AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
+	[gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
+
+AC_ARG_ENABLE(werror,
+	AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
+	[gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
+
+
 AC_ARG_ENABLE(parport,
   AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), 
   [build_parport=$enableval], [build_parport=no])
@@ -684,6 +693,12 @@
 
 # set default gcc warnings
 GCC_WARNINGS="-Wall -Wstrict-prototypes"
+if test "${gcc_wextra}" = yes; then
+	GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
+fi
+if test "${gcc_werror}" = yes; then
+	GCC_WARNINGS="${GCC_WARNINGS} -Werror"
+fi
 
 # overide default gcc cflags
 if test $gcc_warnings = yes; then
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to