Cxx17 refac ci build (#4508)

* Merge #18750: build: optionally skip external warnings

ba8950ee0134a7958e3e9b041cd54d222feb09a1 build: optionally skip external warnings (Vasil Dimov)

Pull request description:

  Add an option to `./configure` to suppress compilation warnings from
  external headers. The option is off by default (no change in behavior,
  show warnings from external headers).

  This option is useful if e.g. Boost or Qt is installed outside of
  `/usr/include` (warnings from headers in `/usr/include` are already
  suppressed by default) and those warnings stand in the way of compiling
  Bitcoin Core with `-Werror[=...]` or they just clutter the build output
  too much and make our own warnings hard to spot.

  `-isystem /usr/include` bricks GCC's `#include_next`, so we use
  `-idirafter` instead. This way we don't have to treat `/usr/include`
  specially.

ACKs for top commit:
  practicalswift:
    ACK ba8950ee0134a7958e3e9b041cd54d222feb09a1: diff looks correct!
  hebasto:
    ACK ba8950ee0134a7958e3e9b041cd54d222feb09a1, tested on Linux Mint 20 (x86_64).
  luke-jr:
    utACK ba8950ee0134a7958e3e9b041cd54d222feb09a1

Tree-SHA512: 9b54fae8590be6c79f2688a5aca09e0a9067f481dabecdd49bb278c08a62ac2b0cc704c894fbd53240e77ac84da0c7a237845df0a696cfbdb0359e1c8e2e10c9

* add --enable-suppress-external-warnings to matrix.sh

Co-authored-by: Wladimir J. van der Laan <laanwj@protonmail.com>
This commit is contained in:
PastaPastaPasta 2021-10-11 17:56:11 -04:00 committed by GitHub
parent 628c6160b6
commit 7be48286f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 4 deletions

View File

@ -40,7 +40,7 @@ if [ "$BUILD_TARGET" = "arm-linux" ]; then
export CHECK_DOC=1 export CHECK_DOC=1
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1" # -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
# This could be removed once the ABI change warning does not show up by default # This could be removed once the ABI change warning does not show up by default
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports --enable-werror CXXFLAGS=-Wno-psabi" export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports --enable-suppress-external-warnings --enable-werror CXXFLAGS=-Wno-psabi"
export RUN_UNITTESTS=false export RUN_UNITTESTS=false
export RUN_INTEGRATIONTESTS=false export RUN_INTEGRATIONTESTS=false
elif [ "$BUILD_TARGET" = "win64" ]; then elif [ "$BUILD_TARGET" = "win64" ]; then
@ -62,7 +62,7 @@ elif [ "$BUILD_TARGET" = "linux64" ]; then
elif [ "$BUILD_TARGET" = "linux64_cxx17" ]; then elif [ "$BUILD_TARGET" = "linux64_cxx17" ]; then
export HOST=x86_64-unknown-linux-gnu export HOST=x86_64-unknown-linux-gnu
export DEP_OPTS="NO_UPNP=1 DEBUG=1" export DEP_OPTS="NO_UPNP=1 DEBUG=1"
export BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports --enable-crash-hooks --enable-c++17 --enable-werror --with-sanitizers=undefined" export BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports --enable-crash-hooks --enable-c++17 --enable-suppress-external-warnings --enable-werror --with-sanitizers=undefined"
export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG" export CPPFLAGS="-DDEBUG_LOCKORDER -DENABLE_DASH_DEBUG -DARENA_DEBUG"
export PYZMQ=true export PYZMQ=true
export RUN_INTEGRATIONTESTS=false export RUN_INTEGRATIONTESTS=false

View File

@ -172,6 +172,16 @@ AC_ARG_ENABLE([ccache],
[use_ccache=$enableval], [use_ccache=$enableval],
[use_ccache=auto]) [use_ccache=auto])
dnl Suppress warnings from external headers (e.g. Boost, Qt).
dnl May be useful if warnings from external headers clutter the build output
dnl too much, so that it becomes difficult to spot Bitcoin Core warnings
dnl or if they cause a build failure with --enable-werror.
AC_ARG_ENABLE([suppress-external-warnings],
[AS_HELP_STRING([--enable-suppress-external-warnings],
[Suppress warnings from external headers (default is no)])],
[suppress_external_warnings=$enableval],
[suppress_external_warnings=no])
AC_ARG_ENABLE([lcov], AC_ARG_ENABLE([lcov],
[AS_HELP_STRING([--enable-lcov], [AS_HELP_STRING([--enable-lcov],
[enable lcov testing (default is no)])], [enable lcov testing (default is no)])],
@ -1089,9 +1099,24 @@ AC_SUBST(LEVELDB_CPPFLAGS)
AC_SUBST(LIBLEVELDB) AC_SUBST(LIBLEVELDB)
AC_SUBST(LIBMEMENV) AC_SUBST(LIBMEMENV)
dnl SUPPRESSED_CPPFLAGS=SUPPRESS_WARNINGS([$SOME_CPPFLAGS])
dnl Replace -I with -isystem in $SOME_CPPFLAGS to suppress warnings from
dnl headers from its include directories and return the result.
dnl See -isystem documentation:
dnl https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
dnl https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-isystem-directory
dnl Do not change "-I/usr/include" to "-isystem /usr/include" because that
dnl is not necessary (/usr/include is already a system directory) and because
dnl it would break GCC's #include_next.
AC_DEFUN([SUPPRESS_WARNINGS],
[$(echo $1 |${SED} -E -e 's/(^| )-I/\1-isystem /g' -e 's;-isystem /usr/include([/ ]|$);-I/usr/include\1;g')])
if test x$enable_wallet != xno; then if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48 BITCOIN_FIND_BDB48
if test x$suppress_external_warnings != xno ; then
BDB_CPPFLAGS=SUPPRESS_WARNINGS($BDB_CPPFLAGS)
fi
fi fi
dnl Check for libminiupnpc (optional) dnl Check for libminiupnpc (optional)
@ -1128,6 +1153,14 @@ BITCOIN_QT_INIT
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
BITCOIN_QT_CONFIGURE([5.5.1]) BITCOIN_QT_CONFIGURE([5.5.1])
dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc
QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES
if test x$suppress_external_warnings != xno ; then
QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES)
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi
if test x$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnononononono; then if test x$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnononononono; then
use_boost=no use_boost=no
else else
@ -1149,6 +1182,10 @@ AX_BOOST_FILESYSTEM
AX_BOOST_THREAD AX_BOOST_THREAD
AX_BOOST_CHRONO AX_BOOST_CHRONO
if test x$suppress_external_warnings != xno; then
BOOST_CPPFLAGS=SUPPRESS_WARNINGS($BOOST_CPPFLAGS)
fi
dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic
dnl counter implementations. In 1.63 and later the std::atomic approach is default. dnl counter implementations. In 1.63 and later the std::atomic approach is default.
m4_pattern_allow(DBOOST_AC_USE_STD_ATOMIC) dnl otherwise it's treated like a macro m4_pattern_allow(DBOOST_AC_USE_STD_ATOMIC) dnl otherwise it's treated like a macro

View File

@ -477,11 +477,11 @@ ui_%.h: %.ui
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false) $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
%.moc: %.cpp %.moc: %.cpp
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES) $(MOC_DEFS) $< | \ $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
moc_%.cpp: %.h moc_%.cpp: %.h
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES) $(MOC_DEFS) $< | \ $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
%.qm: %.ts %.qm: %.ts