noreturn
attributes have been added to the mingw-w64 headers, https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe, meaning that from 11.0.0 onwards, you’ll no-longer see -Wreturn-type
warnings when using assert(false)
.
Add -Wno-return-type to the Windows CI, where it 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, using:
0#include <cassert>
1
2int f(){ assert(false); }
3
4int main() {
5 return 0;
6}
On Mantic (with 11.0.0):
0x86_64-w64-mingw32-g++ test.cpp -Wreturn-type
1# nada
On Lunar (with 10.0.0):
0x86_64-w64-mingw32-g++ test.cpp -Wreturn-type
1test.cpp: In function 'int f()':
2test.cpp:3:25: warning: no return statement in function returning non-void [-Wreturn-type]
3 3 | int f(){ assert(false); }
4 | ^