aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-01-15 09:24:32 -0800
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-01-17 10:04:48 -0800
commitcd722e33ba845a494ae19a6a45dfe4f60217a7a5 (patch)
tree71aa048393e9bcb77f91bf991556ace8900970db
parent4c0f9f51404c26597aaf4a8b182b7de26e3df9c6 (diff)
downloadpaludis-cd722e33ba845a494ae19a6a45dfe4f60217a7a5.tar.gz
paludis-cd722e33ba845a494ae19a6a45dfe4f60217a7a5.tar.xz
build: cleanup and simplify flags handling
The ruby headers use some idioms which generate warnings when building paludis. Rather than assuming that the associated -Wno-* flags are supported by the compiler frontend, explicitly check for the support when necessary (building the Ruby bindings). This slightly speeds up the build when ruby is disabled, but more importantly, will prevent the accidental usage of these flags more broadly.
-rw-r--r--configure.ac48
-rw-r--r--paludis/Makefile.am.m43
-rw-r--r--paludis/util/Makefile.am.m42
-rw-r--r--python/Makefile.am6
-rw-r--r--ruby/Makefile.am2
-rw-r--r--src/clients/cave/Makefile.am2
6 files changed, 17 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac
index 68ce726..e3c6d55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,7 @@ AM_INIT_AUTOMAKE
AC_LANG([C++])
PALUDIS_CXXFLAGS=
+PALUDIS_RUBY_CXXFLAGS=
dnl {{{ git revision
if test -d "${GIT_DIR:-${ac_top_srcdir:-./}/.git}" ; then
@@ -306,13 +307,6 @@ int main(int, char **)
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([RT_LIBS])
-PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST=
-PALUDIS_CXXFLAGS_NO_WREDUNDANT_DECLS=
-PALUDIS_CXXFLAGS_NO_WSHADOW=
-PALUDIS_CXXFLAGS_NO_WUNUSED=
-PALUDIS_CXXFLAGS_NO_WEXTRA=
-PALUDIS_CXXFLAGS_NO_WWRITE_STRINGS=
-PALUDIS_CXXFLAGS_NO_WMISSING_NORETURN=
PALUDIS_CXXFLAGS_NO_STRICT_ALIASING=
AC_DEFUN([CHECK_CXXFLAG], [
@@ -340,42 +334,23 @@ int main(int, char **)
if test "x${ac_cv_cxx_compiler_gnu}" = "xyes" ; then
CHECK_CXXFLAG([-Wall])
CHECK_CXXFLAG([-Wextra])
- if ! test "x$cxxflag_success" = "xyes" ; then
+ if test x"$cxxflag_success" = x"no" ; then
CHECK_CXXFLAG([-W])
- else
- PALUDIS_CXXFLAGS_NO_WEXTRA=-Wno-extra
fi
CHECK_CXXFLAG([-Wold-style-cast])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST=-Wno-old-style-cast
- fi
CHECK_CXXFLAG([-Wredundant-decls])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WREDUNDANT_DECLS=-Wno-redundant-decls
- fi
CHECK_CXXFLAG([-Wstrict-null-sentinel])
CHECK_CXXFLAG([-Wmissing-noreturn])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WMISSING_NORETURN=-Wno-missing-noreturn
- fi
CHECK_CXXFLAG([-Woverloaded-virtual])
CHECK_CXXFLAG([-Winit-self])
CHECK_CXXFLAG([-Wunreachable-code])
CHECK_CXXFLAG([-Wunused])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WUNUSED=-Wno-unused
- fi
CHECK_CXXFLAG([-Wunused-function])
CHECK_CXXFLAG([-Wshadow])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WSHADOW=-Wno-shadow
- fi
CHECK_CXXFLAG([-Wwrite-strings])
CHECK_CXXFLAG([-Wsignature-shadow])
CHECK_CXXFLAG([-Wfloat-equal])
- if test "x$cxxflag_success" = "xyes" ; then
- PALUDIS_CXXFLAGS_NO_WWRITE_STRINGS=-Wno-write-strings
- fi
+
CHECK_CXXFLAG([-Wno-ignored-qualifiers])
CHECK_CXXFLAG([-Wno-non-virtual-dtor])
else
@@ -392,13 +367,6 @@ CHECK_CXXFLAG([-fvisibility=hidden])
CHECK_CXXFLAG([-fvisibility-inlines-hidden])
AC_SUBST([PALUDIS_CXXFLAGS])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WSHADOW])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WREDUNDANT_DECLS])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WEXTRA])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WUNUSED])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WWRITE_STRINGS])
-AC_SUBST([PALUDIS_CXXFLAGS_NO_WMISSING_NORETURN])
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $PALUDIS_CXXFLAGS"
@@ -724,6 +692,16 @@ if test "x$enable_ruby" = "xyes" ; then
AC_SUBST([RUBY])
AC_SUBST([RUBY_INSTALL_DIR])
+
+ ruby_saved_CXXFLAGS="$CXXFLAGS"
+ ruby_saved_PALUDIS_CXXFLAGS="$PALUDIS_CXXFLAGS"
+ CHECK_CXXFLAG([-Wno-shadow])
+ CHECK_CXXFLAG([-Wno-redundant-decls])
+ CHECK_CXXFLAG([-Wno-old-style-cast])
+ PALUDIS_RUBY_CXXFLAGS="$PALUDIS_CXXFLAGS"
+ AC_SUBST([PALUDIS_RUBY_CXXFLAGS])
+ CXXFLAGS="$ruby_saved_CXXFLAGS"
+ PALUDIS_CXXFLAGS="$ruby_saved_PALUDIS_CXXFLAGS"
fi
AM_CONDITIONAL([ENABLE_RUBY], test "x$enable_ruby" = "xyes")
dnl }}}
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index bfc6ecd..72c1af1 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -50,7 +50,7 @@ ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
define(`add', `addthis(`$1',`$2')addthis(`$1',`$3')addthis(`$1',`$4')dnl
addthis(`$1',`$5')addthis(`$1',`$6')addthis(`$1',`$7')addthis(`$1',`$8')')dnl
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
include(`paludis/files.m4')
@@ -75,7 +75,6 @@ libpaludis_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@V
libpaludispythonhooks_@PALUDIS_PC_SLOT@_la_SOURCES = python_hooks.cc
libpaludispythonhooks_@PALUDIS_PC_SLOT@_la_CXXFLAGS = $(AM_CXXFLAGS) \
@PALUDIS_CXXFLAGS_NO_STRICT_ALIASING@ \
- @PALUDIS_CXXFLAGS_NO_WSHADOW@ \
-I@PYTHON_INCLUDE_DIR@
libpaludispythonhooks_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0 @BOOST_PYTHON_LIB@ -lpython@PYTHON_VERSION@
libpaludispythonhooks_@PALUDIS_PC_SLOT@_la_LIBADD = libpaludis_@PALUDIS_PC_SLOT@.la
diff --git a/paludis/util/Makefile.am.m4 b/paludis/util/Makefile.am.m4
index fc41c0b..bc4f550 100644
--- a/paludis/util/Makefile.am.m4
+++ b/paludis/util/Makefile.am.m4
@@ -48,7 +48,7 @@ ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
define(`add', `addthis(`$1',`$2')addthis(`$1',`$3')addthis(`$1',`$4')dnl
addthis(`$1',`$5')addthis(`$1',`$6')addthis(`$1',`$7')addthis(`$1',`$8')')dnl
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
include(`paludis/util/files.m4')
diff --git a/python/Makefile.am b/python/Makefile.am
index 9dff4f8..92a145f 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -5,12 +5,6 @@ SUBDIRS = .
AM_CXXFLAGS = -I$(top_srcdir) -I$(srcdir)/ \
-I$(top_builddir)/ \
@PALUDIS_CXXFLAGS@ \
- @PALUDIS_CXXFLAGS_NO_WUNUSED@ \
- @PALUDIS_CXXFLAGS_NO_WSHADOW@ \
- @PALUDIS_CXXFLAGS_NO_WEXTRA@ \
- @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@ \
- @PALUDIS_CXXFLAGS_NO_WWRITE_STRINGS@ \
- @PALUDIS_CXXFLAGS_NO_WMISSING_NORETURN@ \
@PALUDIS_CXXFLAGS_NO_STRICT_ALIASING@ \
@PALUDIS_CXXFLAGS_NO_DEBUGGING@
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 06655d0..66fd38c 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS = . demos
AM_CXXFLAGS = -I$(top_srcdir) -I$(srcdir)/ \
-I$(top_builddir)/ \
- @PALUDIS_CXXFLAGS@
+ @PALUDIS_RUBY_CXXFLAGS@
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index 8489c68..75db797 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/misc/common-makefile.am
AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src \
- @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@
+ @PALUDIS_CXXFLAGS@
DEFS= \
-DBINDIR=\"$(bindir)\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \