summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2016-10-15 21:39:31 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2016-10-17 11:44:11 +0100
commit20b2e479f8256184eda0e0d44c1599b27104627a (patch)
treeedadb5bcae004a48a1a7c3893b3c0e1679a28566 /configure.ac
parent6a9be60a1689b46bca2c5d51203c3a3752b12673 (diff)
downloadgtk+-20b2e479f8256184eda0e0d44c1599b27104627a.tar.gz
build: Add various compiler warnings and errors
Just like GLib, GTK+ would benefit from getting warnings and errors from the compilers. We check various, common warnings, especially for a future use of C99; additionally, we promote some warnings to errors, in order to ensure that simple mistakes are caught during the development phase, before they are submitted to the code repository.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 31 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 35038a3a82..3ce9c316df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1862,6 +1862,37 @@ _______EOF
gdk_windowing='$GDK_WINDOWING'
])
+dnl Compiler flags; macro originates from systemd
+dnl See https://bugzilla.gnome.org/show_bug.cgi?id=608953
+AC_ARG_ENABLE(compile-warnings,
+ [AS_HELP_STRING([--disable-compile-warnings], [Do not use builtin compiler warnings])],
+ [],
+ [enable_compile_warnings=yes])
+AS_IF([test "x$enable_compile_warnings" = xyes], [
+ AX_APPEND_COMPILE_FLAGS([ dnl
+ -Wall dnl
+ -Wundef dnl
+ -Wnested-externs dnl
+ -Wpointer-arith dnl
+ -Wstrict-prototypes dnl
+ -Wcast-align dnl
+ -Wuninitialized dnl
+ -Wmissing-include-dirs dnl
+ -Wshadow dnl
+ -Wformat=2 dnl
+ -Wformat-non-literal dnl
+ -Wformat-security dnl
+ -Wimplicit-function-declaration dnl
+ -Werror=redundant-decls dnl
+ -Werror=write-strings dnl
+ -Werror=missing-declarations dnl
+ -Werror=missing-prototypes dnl
+ -Werror=empty-body dnl
+ -Werror=init-self dnl
+ ], [GTK_WARN_CFLAGS])
+])
+AC_SUBST(GTK_WARN_CFLAGS)
+
dnl
dnl Check for -Bsymbolic-functions linker flag used to avoid
dnl intra-library PLT jumps, if available.