From a21649b79f749ed15287c020e981a527e6d028cb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 12 Apr 2012 16:38:34 +0100 Subject: [PATCH 1/2] Merge the various "fatal warnings or not?" options I've kept --disable-Werror (it's from a reusable macro for -Werror), but distributors should now use --disable-fatal-warnings to control all the potentially-fatal checks simultaneously. --- configure.ac | 54 ++++++++++++++++++++----------------------- docs/reference/Makefile.am | 2 +- tools/check-coding-style.mk | 2 +- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/configure.ac b/configure.ac index cb9f30b..acddce5 100644 --- a/configure.ac +++ b/configure.ac @@ -75,10 +75,28 @@ LINKER_OPTIMISATIONS LINKER_VERSION_SCRIPT ifelse(tp_glib_nano_version, 0, - [ official_release=yes ], - [ official_release=no ]) +[ # tp-glib is version x.y.z - "official release", + # disable extra checks by default + official_release=yes + AC_ARG_ENABLE([fatal-warnings], + [AC_HELP_STRING([--enable-fatal-warnings], + [make various warnings fatal])], + [], + [enable_fatal_warnings=no]) +], +[ # tp-glib is version x.y.z.1 - development snapshot, + # enable extra checks by default + official_release=no + AC_ARG_ENABLE([fatal-warnings], + [AC_HELP_STRING([--disable-fatal-warnings], + [make various warnings non-fatal])], + [], + [enable_fatal_warnings=yes]) +]) -TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$official_release" = xno], +AC_SUBST([enable_fatal_warnings]) + +TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$enable_fatal_warnings" = xyes], [all \ extra \ declaration-after-statement \ @@ -96,7 +114,7 @@ AC_SUBST([ERROR_CFLAGS]) # these aren't really error flags but they serve a similar purpose for us - # making the toolchain stricter -if test "x$official_release" = xno; then +if test "x$enable_fatal_warnings" = xyes; then TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-copy-dt-needed-entries]) # --no-copy-dt-needed-entries is the new name for --no-add-needed which @@ -110,6 +128,9 @@ if test "x$official_release" = xno; then esac fi +# Only use this where we really do want things to depend on whether it's +# a release or not (like ABI-stability enforcement). For fatal warnings, +# use ${enable_fatal_warnings} instead. AM_CONDITIONAL([OFFICIAL_RELEASE], [test "x$official_release" = xyes]) AC_ARG_ENABLE(debug, @@ -131,31 +152,6 @@ AC_ARG_ENABLE(backtrace, AC_HELP_STRING([--enable-backtrace],[enable printing out the backtrace in case of crash (in most GLib connection managers)]), enable_backtrace=$enableval, enable_backtrace=no ) -ifelse(tp_glib_nano_version, 0, -[ # tp-glib is version x.y.z - disable extra checks by default - AC_ARG_ENABLE(coding-style-checks, - AC_HELP_STRING([--enable-coding-style-checks], - [check coding style using grep]), - [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=no] ) - AC_ARG_ENABLE(doc-checks, - AC_HELP_STRING([--enable-doc-checks], - [check for complete documentation coverage]), - [ENABLE_DOC_CHECKS=$enableval], [ENABLE_DOC_CHECKS=no] ) -], -[ # tp-glib is version x.y.z.1 - enable extra checks by default - AC_ARG_ENABLE(coding-style-checks, - AC_HELP_STRING([--disable-coding-style-checks], - [do not check coding style using grep]), - [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=yes]) - AC_ARG_ENABLE(doc-checks, - AC_HELP_STRING([--disable-doc-checks], - [do not check for complete documentation coverage]), - [ENABLE_DOC_CHECKS=$enableval], [ENABLE_DOC_CHECKS=yes]) -]) - -AC_SUBST([ENABLE_CODING_STYLE_CHECKS]) -AC_SUBST([ENABLE_DOC_CHECKS]) - if test x$enable_debug = xyes; then AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code]) fi diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index c407607..fbdee20 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -168,7 +168,7 @@ check-local: err=1; \ fi; \ done; \ - case @ENABLE_DOC_CHECKS@/$$err in \ + case $(enable_fatal_warnings)/$$err in \ (yes/1) \ echo "Documentation check failed" >&2; \ exit $$err; \ diff --git a/tools/check-coding-style.mk b/tools/check-coding-style.mk index 1c0a60f..f3f74fa 100644 --- a/tools/check-coding-style.mk +++ b/tools/check-coding-style.mk @@ -10,7 +10,7 @@ check-coding-style: sh $(top_srcdir)/tools/check-c-style.sh \ $(addprefix $(srcdir)/,$(check_c_sources)) || fail=1; \ fi;\ - if test yes = "$(ENABLE_CODING_STYLE_CHECKS)"; then \ + if test yes = "$(enable_fatal_warnings)"; then \ exit "$$fail";\ else \ exit 0;\ -- 1.7.10