mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
build: quiet annoying warnings without adding new ones
Disabling warnings can be tricky, because doing so can cause a different
compiler to create new warnings about unsupported disable flags. Also, some
warnings don't surface until they're paired with another warning (gcc). For
example, adding "-Wno-foo" won't cause any trouble, but if there's a legitimate
warning emitted, the "unknown option -Wno-foo" will show up as well.
Work around this in 2 ways:
1. When checking to see if -Wno-foo is supported, check for "-Wfoo" instead.
2. Enable -Werror while checking 1.
If "-Werror -Wfoo" compiles, "-Wno-foo" is almost guaranteed to be supported.
-Werror itself is also checked. If that fails to compile by itself, it likely
means that the user added a flag that adds a warning. In that case, -Werror
won't be used while checking, and the build may be extra noisy. The user would
need to fix the bad input flag.
Also, silence 2 more additional warnings that can show up post-c++11.
(cherry picked from commit 63b3111f84
)
This commit is contained in:
parent
31bc9d4ee8
commit
cdb2b1944c
21
configure.ac
21
configure.ac
@ -187,6 +187,9 @@ AC_ARG_ENABLE([debug],
|
|||||||
[enable_debug=$enableval],
|
[enable_debug=$enableval],
|
||||||
[enable_debug=no])
|
[enable_debug=no])
|
||||||
|
|
||||||
|
AC_LANG_PUSH([C++])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""])
|
||||||
|
|
||||||
if test "x$enable_debug" = xyes; then
|
if test "x$enable_debug" = xyes; then
|
||||||
CPPFLAGS="$CPPFLAGS -DDEBUG"
|
CPPFLAGS="$CPPFLAGS -DDEBUG"
|
||||||
if test "x$GCC" = xyes; then
|
if test "x$GCC" = xyes; then
|
||||||
@ -198,11 +201,19 @@ if test "x$enable_debug" = xyes; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## TODO: Remove these hard-coded paths and flags. They are here for the sake of
|
|
||||||
## compatibility with the legacy buildsystem.
|
|
||||||
##
|
|
||||||
if test "x$CXXFLAGS_overridden" = "xno"; then
|
if test "x$CXXFLAGS_overridden" = "xno"; then
|
||||||
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-self-assign -Wno-implicit-fallthrough"
|
AX_CHECK_COMPILE_FLAG([-Wall],[CXXFLAGS="$CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wextra],[CXXFLAGS="$CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wformat],[CXXFLAGS="$CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wformat-security],[CXXFLAGS="$CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]])
|
||||||
|
|
||||||
|
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
|
||||||
|
## unknown options if any other warning is produced. Test the -Wfoo case, and
|
||||||
|
## set the -Wno-foo case if it works.
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wself-assign],[CXXFLAGS="$CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wdeprecated-register],[CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"],,[[$CXXFLAG_WERROR]])
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
|
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
|
||||||
|
|
||||||
@ -224,8 +235,6 @@ AC_ARG_WITH([daemon],
|
|||||||
[build_bitcoind=$withval],
|
[build_bitcoind=$withval],
|
||||||
[build_bitcoind=yes])
|
[build_bitcoind=yes])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
|
|
||||||
use_pkgconfig=yes
|
use_pkgconfig=yes
|
||||||
case $host in
|
case $host in
|
||||||
*mingw*)
|
*mingw*)
|
||||||
|
Loading…
Reference in New Issue
Block a user