Build warnings

26 views
Skip to first unread message

Сергей Коныгин

unread,
Jun 4, 2026, 1:10:53 AM (3 days ago) Jun 4
to wx-users
Hi!

I get frequent warnings when compiling wxWidgets. 

For example, when compiling version 3.3.2 using the command line

mingw32-make.exe SHELL=CMD.exe -f makefile.gcc -j24 SHARED=0 MONOLITHIC=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wunused-variable"

I get the following warnings

implicit-fallthrough, missing-field-initializers, cast-function-type, deprecated.

Is this normal? Perhaps I should change the compilation options?

Igor Korot

unread,
Jun 4, 2026, 1:33:07 AM (3 days ago) Jun 4
to wx-u...@googlegroups.com
Hi,

On Thu, Jun 4, 2026 at 12:10 AM Сергей Коныгин <steev...@gmail.com> wrote:
>
> Hi!
>
> I get frequent warnings when compiling wxWidgets.
>
> For example, when compiling version 3.3.2 using the command line
>
> mingw32-make.exe SHELL=CMD.exe -f makefile.gcc -j24 SHARED=0 MONOLITHIC=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -Wno-unused-local-typedefs -Wno-deprecated-declarations -Wunused-variable"
>
> I get the following warnings
>
> implicit-fallthrough, missing-field-initializers, cast-function-type, deprecated.

What file(s) this is coming from?
Can you show the backtrace?

Thank you.

>
> Is this normal? Perhaps I should change the compilation options?
>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/wx-users/3d76fe7b-c6b0-4341-8bbf-d9fe4adcde7fn%40googlegroups.com.

Сергей Коныгин

unread,
Jun 4, 2026, 2:08:57 AM (3 days ago) Jun 4
to wx-users
../../src/common/numformatter.cpp: In static member function 'static wxString wxNumberFormatter::RemoveCurrencySymbolOrCode(wxString, int)':
../../src/common/numformatter.cpp:355:32: warning: this statement may fall through [-Wimplicit-fallthrough=]
  355 |                 currencyStr += wxString(" ");
      |                                ^~~~~~~~~~~~~
../../src/common/numformatter.cpp:357:13: note: here
  357 |             case wxCurrencySymbolPosition::PrefixNoSep:
      |             ^~~~
../../src/common/numformatter.cpp:362:45: warning: this statement may fall through [-Wimplicit-fallthrough=]
  362 |                 currencyStr = wxString(" ") + currencyStr;
      |                               ~~~~~~~~~~~~~~^~~~~~~~~~~~~
../../src/common/numformatter.cpp:364:13: note: here
  364 |             case wxCurrencySymbolPosition::SuffixNoSep:
      |             ^~~~
In file included from ../../src/msw/settings.cpp:34:
..\..\include/wx/msw/private/metrics.h: In function 'bool wxMSWImpl::IsHighContrast()':
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
   43 |     HIGHCONTRAST hc = { sizeof(hc) };
      |                                    ^
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::lpszDefaultScheme' [-Wmissing-field-initializers]
In file included from ../../src/msw/window.cpp:80:
..\..\include/wx/msw/private/metrics.h: In function 'bool wxMSWImpl::IsHighContrast()':
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
   43 |     HIGHCONTRAST hc = { sizeof(hc) };
      |                                    ^
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::lpszDefaultScheme' [-Wmissing-field-initializers]
../../src/msw/joystick.cpp: In lambda function:
../../src/msw/joystick.cpp:438:27: warning: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
  438 |     auto GetNameFromReg = [=](wxRegKey::StdKey root) -> wxString
      |                           ^
../../src/msw/joystick.cpp:438:27: note: add explicit 'this' or '*this' capture
In file included from ../../src/msw/darkmode.cpp:127:
..\..\include/wx/msw/private/metrics.h: In function 'bool wxMSWImpl::IsHighContrast()':
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
   43 |     HIGHCONTRAST hc = { sizeof(hc) };
      |                                    ^
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::lpszDefaultScheme' [-Wmissing-field-initializers]
../../src/msw/darkmode.cpp: In instantiation of 'bool {anonymous}::TryLoadByOrd(T&, const wxDynamicLibrary&, int) [with T = bool (__attribute__((stdcall)) *)()]':
../../src/msw/darkmode.cpp:197:24:   required from here
  197 |     return TryLoadByOrd(ShouldAppsUseDarkMode, dllUxTheme, 132) &&
      |            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/msw/darkmode.cpp:154:12: warning: cast between incompatible function types from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to 'bool (__attribute__((stdcall)) *)()' [-Wcast-function-type]
  154 |     func = (T)::GetProcAddress(lib.GetLibHandle(), MAKEINTRESOURCEA(ordinal));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/msw/darkmode.cpp: In instantiation of 'bool {anonymous}::TryLoadByOrd(T&, const wxDynamicLibrary&, int) [with T = bool (__attribute__((stdcall)) *)(HWND__*, bool)]':
../../src/msw/darkmode.cpp:198:24:   required from here
  198 |            TryLoadByOrd(AllowDarkModeForWindow, dllUxTheme, 133) &&
      |            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/msw/darkmode.cpp:154:12: warning: cast between incompatible function types from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to 'bool (__attribute__((stdcall)) *)(HWND__*, bool)' [-Wcast-function-type]
  154 |     func = (T)::GetProcAddress(lib.GetLibHandle(), MAKEINTRESOURCEA(ordinal));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/msw/darkmode.cpp: In instantiation of 'bool {anonymous}::TryLoadByOrd(T&, const wxDynamicLibrary&, int) [with T = long unsigned int (__attribute__((stdcall)) *)(long unsigned int)]':
../../src/msw/darkmode.cpp:199:24:   required from here
  199 |            TryLoadByOrd(SetPreferredAppMode, dllUxTheme, 135);
      |            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/msw/darkmode.cpp:154:12: warning: cast between incompatible function types from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to 'long unsigned int (__attribute__((stdcall)) *)(long unsigned int)' [-Wcast-function-type]
  154 |     func = (T)::GetProcAddress(lib.GetLibHandle(), MAKEINTRESOURCEA(ordinal));
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../src/msw/menuitem.cpp:134:
..\..\include/wx/msw/private/metrics.h: In function 'bool wxMSWImpl::IsHighContrast()':
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
   43 |     HIGHCONTRAST hc = { sizeof(hc) };
      |                                    ^
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::lpszDefaultScheme' [-Wmissing-field-initializers]
In file included from ../../src/msw/msgdlg.cpp:28:
..\..\include/wx/msw/private/metrics.h: In function 'bool wxMSWImpl::IsHighContrast()':
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
   43 |     HIGHCONTRAST hc = { sizeof(hc) };
      |                                    ^
..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer for member 'tagHIGHCONTRASTW::lpszDefaultScheme' [-Wmissing-field-initializers]


четверг, 4 июня 2026 г. в 09:33:07 UTC+4, Igor Korot:

Vadim Zeitlin

unread,
Jun 4, 2026, 8:58:48 AM (2 days ago) Jun 4
to wx-u...@googlegroups.com
On Wed, 3 Jun 2026 23:08:57 -0700 (PDT) Сергей Коныгин wrote:

СК> ../../src/common/numformatter.cpp: In static member function 'static
СК> wxString wxNumberFormatter::RemoveCurrencySymbolOrCode(wxString, int)':
СК> ../../src/common/numformatter.cpp:355:32: warning: this statement may fall
СК> through [-Wimplicit-fallthrough=]
СК> 355 | currencyStr += wxString(" ");
СК> | ^~~~~~~~~~~~~

This (and other -Wimplicit-fallthrough) warnings are strange, it looks
like wxFALLTHROUGH is not defined correctly somehow for you. As the other
warnings below indicate, you are using C++20 (or later), so it should be
defined as [[fallthrough]] and no warning should be given then.

СК> In file included from ../../src/msw/settings.cpp:34:
СК> ..\..\include/wx/msw/private/metrics.h: In function 'bool
СК> wxMSWImpl::IsHighContrast()':
СК> ..\..\include/wx/msw/private/metrics.h:43:36: warning: missing initializer
СК> for member 'tagHIGHCONTRASTW::dwFlags' [-Wmissing-field-initializers]
СК> 43 | HIGHCONTRAST hc = { sizeof(hc) };
СК> | ^

This has been already fixed in dcec891a5c (Use WinStruct<> instead of
manually initializing HIGHCONTRAST, 2026-04-18).

СК> ../../src/msw/joystick.cpp: In lambda function:
СК> ../../src/msw/joystick.cpp:438:27: warning: implicit capture of 'this' via
СК> '[=]' is deprecated in C++20 [-Wdeprecated]
СК> 438 | auto GetNameFromReg = [=](wxRegKey::StdKey root) -> wxString
СК> | ^
СК> ../../src/msw/joystick.cpp:438:27: note: add explicit 'this' or '*this'
СК> capture

This needs to be fixed, but it's a bit tricky because we can't capture
"this" explicitly when using earlier C++ standards, so we'd need to add
something like

#if wxCHECK_CXX_STD(202002L)
#define wxCAPTURE_THIS , this
#else
#define wxCAPTURE_THIS
#endif

and then use it like this

auto GetNameFromReg = [= wxCAPTURE_THIS](wxRegKey::StdKey root) -> wxString


СК> ../../src/msw/darkmode.cpp: In instantiation of 'bool
СК> {anonymous}::TryLoadByOrd(T&, const wxDynamicLibrary&, int) [with T = bool
СК> (__attribute__((stdcall)) *)()]':
СК> ../../src/msw/darkmode.cpp:197:24: required from here
СК> 197 | return TryLoadByOrd(ShouldAppsUseDarkMode, dllUxTheme, 132) &&
СК> | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
СК> ../../src/msw/darkmode.cpp:154:12: warning: cast between incompatible
СК> function types from 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'} to
СК> 'bool (__attribute__((stdcall)) *)()' [-Wcast-function-type]

We'll have to suppress this warning, there is no way around it.

The goal is for wx to build without warnings, but it's not always simple
to achieve due to the number of compilers and build options. If you
encounter warnings, please open issues for them and, if you can, make PRs
to fix them.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages