Skip to content

Commit c713bb2

Browse files
committed
Fix Windows build with --enable-werror on Ubuntu Focal
1 parent f0b4572 commit c713bb2

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

configure.ac

+7-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,13 @@ if test "x$enable_werror" = "xyes"; then
430430
AX_CHECK_COMPILE_FLAG([-Werror=range-loop-analysis],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=range-loop-analysis"],,[[$CXXFLAG_WERROR]])
431431
AX_CHECK_COMPILE_FLAG([-Werror=unused-variable],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unused-variable"],,[[$CXXFLAG_WERROR]])
432432
AX_CHECK_COMPILE_FLAG([-Werror=date-time],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=date-time"],,[[$CXXFLAG_WERROR]])
433-
AX_CHECK_COMPILE_FLAG([-Werror=return-type],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=return-type"],,[[$CXXFLAG_WERROR]])
433+
434+
dnl -Wreturn-type is broken in GCC for MinGW-w64.
435+
dnl https://sourceforge.net/p/mingw-w64/bugs/306/
436+
AX_CHECK_COMPILE_FLAG([-Werror=return-type], [ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=return-type"], [], [$CXXFLAG_WERROR],
437+
[AC_LANG_SOURCE([[#include <cassert>
438+
int f(){ assert(false); }]])])
439+
434440
AX_CHECK_COMPILE_FLAG([-Werror=conditional-uninitialized],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=conditional-uninitialized"],,[[$CXXFLAG_WERROR]])
435441
AX_CHECK_COMPILE_FLAG([-Werror=sign-compare],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=sign-compare"],,[[$CXXFLAG_WERROR]])
436442
dnl -Wsuggest-override is broken with GCC before 9.2

src/fs.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ std::string get_filesystem_error_message(const fs::filesystem_error& e)
154154
#ifdef __GLIBCXX__
155155

156156
// reference: https://github.com/gcc-mirror/gcc/blob/gcc-7_3_0-release/libstdc%2B%2B-v3/include/std/fstream#L270
157-
157+
#if defined(__GNUC__) && !defined(__clang__)
158+
#pragma GCC diagnostic push
159+
#pragma GCC diagnostic ignored "-Wswitch"
160+
#endif
158161
static std::string openmodeToStr(std::ios_base::openmode mode)
159162
{
160163
switch (mode & ~std::ios_base::ate) {
@@ -192,6 +195,9 @@ static std::string openmodeToStr(std::ios_base::openmode mode)
192195
return std::string();
193196
}
194197
}
198+
#if defined(__GNUC__) && !defined(__clang__)
199+
#pragma GCC diagnostic pop
200+
#endif
195201

196202
void ifstream::open(const fs::path& p, std::ios_base::openmode mode)
197203
{

src/qt/winshutdownmonitor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class WinShutdownMonitor : public QAbstractNativeEventFilter
1717
{
1818
public:
1919
/** Implements QAbstractNativeEventFilter interface for processing Windows messages */
20-
bool nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult);
20+
bool nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult) override;
2121

2222
/** Register the reason for blocking shutdown on Windows to allow clean client exit */
2323
static void registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId);

0 commit comments

Comments
 (0)