Skip to content

Commit 04f66ce

Browse files
committed
Merge bitcoin/bitcoin#28092: ci: document that -Wreturn-type has been fixed upstream (mingw-w64)
08eb5f1 ci: document that -Wreturn-type has been fixed upstream (Windows) (fanquake) Pull request description: `noreturn` attributes have been added to the mingw-w64 headers, mingw-w64/mingw-w64@1690994, meaning that [from 11.0.0 onwards](https://www.mingw-w64.org/changelog/), you'll no-longer see `-Wreturn-type` warnings when using `assert(false)`. Add -Wno-return-type to the Windows CI, where is should have been all along, and document why it's required. This can be dropped when we are using the fixed version of the mingw-w64 headers there. Drop the -Werror -Wno-return-type special case from our build system. -Wreturn-type is on by default in Clang and GCC. The new mingw-w64 header behaviour can be checked on Ubuntu mantic, [which ships with 11.0.0](https://packages.ubuntu.com/mantic/mingw-w64), using: ```cpp #include <cassert> int f(){ assert(false); } int main() { return 0; } ``` On Mantic (with 11.0.0): ```bash x86_64-w64-mingw32-g++ test.cpp -Wreturn-type # nada ``` On Lunar ([with 10.0.0](https://packages.ubuntu.com/lunar/mingw-w64)): ```bash x86_64-w64-mingw32-g++ test.cpp -Wreturn-type test.cpp: In function 'int f()': test.cpp:3:25: warning: no return statement in function returning non-void [-Wreturn-type] 3 | int f(){ assert(false); } | ^ ``` ACKs for top commit: TheCharlatan: ACK 08eb5f1 Tree-SHA512: 9cd4310a96abd87bf8ceb37949ad0259fe4adee3367c604f4c4ad521a0cf09bdcc5dd305db19a0f45ce74c85178b0d739e2fca5ad0fc841ac935523a23b28a7f
2 parents f57e724 + 08eb5f1 commit 04f66ce

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

ci/test/00_setup_env_win64.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ export DPKG_ADD_ARCH="i386"
1313
export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file"
1414
export RUN_FUNCTIONAL_TESTS=false
1515
export GOAL="deploy"
16-
export BITCOIN_CONFIG="--enable-reduce-exports --enable-external-signer --disable-gui-tests"
16+
# Prior to 11.0.0, the mingw-w64 headers were missing noreturn attributes, causing warnings when
17+
# cross-compiling for Windows. https://sourceforge.net/p/mingw-w64/bugs/306/
18+
# https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe
19+
export BITCOIN_CONFIG="--enable-reduce-exports --enable-external-signer --disable-gui-tests CXXFLAGS=-Wno-return-type"

configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,6 @@ if test "$enable_werror" = "yes"; then
427427
AC_MSG_ERROR([enable-werror set but -Werror is not usable])
428428
fi
429429
ERROR_CXXFLAGS=$CXXFLAG_WERROR
430-
431-
dnl -Wreturn-type is broken in GCC for MinGW-w64.
432-
dnl https://sourceforge.net/p/mingw-w64/bugs/306/
433-
AX_CHECK_COMPILE_FLAG([-Werror=return-type], [], [ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wno-error=return-type"], [$CXXFLAG_WERROR],
434-
[AC_LANG_SOURCE([[#include <cassert>
435-
int f(){ assert(false); }]])])
436430
fi
437431

438432
if test "$CXXFLAGS_overridden" = "no"; then

0 commit comments

Comments
 (0)