From a03441f959242f706ed24e2efee7a61fe939aeec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 12 Nov 2017 16:57:40 +0100 Subject: [PATCH 1/4] Suppress harmless -Wmissing-fields-initialize in wxSecretStore This warning is difficult to avoid as we don't want to initialize the unused/reserved fields of SecretSchema struct, yet the compiler warns about it (when using -Wextra). --- src/unix/secretstore.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/unix/secretstore.cpp b/src/unix/secretstore.cpp index f18d5a0e6d..e72ce36248 100644 --- a/src/unix/secretstore.cpp +++ b/src/unix/secretstore.cpp @@ -235,6 +235,11 @@ private: // helper function to make changing the code later simpler. static SecretSchema* GetSchema() { + // SecretSchema struct has some "reserved" fields in it which we don't + // want to initialize, but this results in this warning if it's + // enabled, so just suppress it here. + wxGCC_WARNING_SUPPRESS(missing-field-initializers) + static SecretSchema s_schema = { "org.freedesktop.Secret.Generic", @@ -246,6 +251,8 @@ private: } }; + wxGCC_WARNING_RESTORE(missing-field-initializers) + return &s_schema; } From 3653b753d31689b15b383a2d234c3000e42f466e Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Sun, 12 Nov 2017 17:02:43 +0100 Subject: [PATCH 2/4] Fix clang -Winconsistent-missing-override in wxGLApp Use "override" for wxGLApp::GetXVisualInfo(), but only for wxGTK2 where it really overrides it, unlike in wxX11. Closes #17995. --- include/wx/unix/glx11.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/wx/unix/glx11.h b/include/wx/unix/glx11.h index 50305778c4..a27c470332 100644 --- a/include/wx/unix/glx11.h +++ b/include/wx/unix/glx11.h @@ -147,6 +147,9 @@ public: // backwards compatibility and also because wxGTK has it we could start // using it for the same purpose in wxX11 too some day. virtual void *GetXVisualInfo() +#ifdef __WXGTK20__ + wxOVERRIDE +#endif { return wxGLCanvasX11::GetDefaultXVisualInfo(); } From b39d29f433b129a4a756e09caf44df69294d74dc Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Sun, 12 Nov 2017 17:05:55 +0100 Subject: [PATCH 3/4] Fix harmless -Wmissing-field-initializers in wxGTK Closes #17996. --- src/gtk/display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index d6562511b8..db1116820d 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -58,7 +58,7 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* if (GDK_IS_X11_SCREEN(screen)) #endif { - GdkRectangle rect = { 0 }; + GdkRectangle rect = { 0, 0, 0, 0 }; wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen), rect.x, rect.y, rect.width, rect.height); // in case _NET_WORKAREA result is too large From fc9d41fad3a8cd7d2917f2f835daf6a73dd32729 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 12 Nov 2017 17:07:35 +0100 Subject: [PATCH 4/4] Avoid -Wmissing-field-initializers for Dl_info struct Rely on the default initialization, this is arguably slightly less clear, but allows to avoid the warning (which is disabled by default, but still). Closes #17997. --- src/unix/dlunix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/dlunix.cpp b/src/unix/dlunix.cpp index 1905c97aca..cf51417a25 100644 --- a/src/unix/dlunix.cpp +++ b/src/unix/dlunix.cpp @@ -285,7 +285,7 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) { #ifdef HAVE_DLADDR - Dl_info di = { 0 }; + Dl_info di = { }; // 0 initialize whatever fields the struct has // At least under Solaris dladdr() takes non-const void*. if ( dladdr(const_cast(addr), &di) == 0 )