From db978c02f18e2a60e4836a08112297e648a48d81 Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Thu, 25 Apr 2024 11:40:24 +0000 Subject: [PATCH] Fix false-positive warnings from GCC14 when building with optimizations on Fedora 40 Signed-off-by: Pavel Solodovnikov --- lib/framework/debug.cpp | 11 ++++++++++- lib/ivis_opengl/gfx_api_gl.cpp | 11 ++++++++++- src/qtscript.cpp | 9 +++++++++ src/urlrequest_curl.cpp | 11 ++++++++++- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lib/framework/debug.cpp b/lib/framework/debug.cpp index ddbfe9a0677..edeeed76845 100644 --- a/lib/framework/debug.cpp +++ b/lib/framework/debug.cpp @@ -34,7 +34,16 @@ #include "wzapp.h" #include #include -#include +// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero +// when compiling with optimizations. Silence these warnings. +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Walloc-zero" +#endif +# include +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic pop +#endif #include #if defined(WZ_OS_LINUX) && defined(__GLIBC__) diff --git a/lib/ivis_opengl/gfx_api_gl.cpp b/lib/ivis_opengl/gfx_api_gl.cpp index 25ba3b2df02..ce024d8cde0 100644 --- a/lib/ivis_opengl/gfx_api_gl.cpp +++ b/lib/ivis_opengl/gfx_api_gl.cpp @@ -31,7 +31,16 @@ #include #include #include -#include +// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero +// when compiling with optimizations. Silence these warnings. +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Walloc-zero" +#endif +# include +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic pop +#endif #include #include #include diff --git a/src/qtscript.cpp b/src/qtscript.cpp index 2259fdfb6aa..80a6023754c 100644 --- a/src/qtscript.cpp +++ b/src/qtscript.cpp @@ -176,7 +176,16 @@ scripting_engine::timerNode::timerNode(timerNode&& rhs) // move constr void scripting_engine::timerNode::swap(timerNode& _rhs) { +// On Fedora 40, GCC 14 produces false-positive warnings for -Wuninitialized +// when compiling this code with optimizations. Silence these warnings. +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wuninitialized" +#endif std::swap(timerID, _rhs.timerID); +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic pop +#endif std::swap(function, _rhs.function); std::swap(timerName, _rhs.timerName); std::swap(instance, _rhs.instance); diff --git a/src/urlrequest_curl.cpp b/src/urlrequest_curl.cpp index f831f79d9bf..b6ac8e1e903 100644 --- a/src/urlrequest_curl.cpp +++ b/src/urlrequest_curl.cpp @@ -57,7 +57,16 @@ #include #include #include -#include +// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero +// when compiling with optimizations. Silence these warnings. +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Walloc-zero" +#endif +# include +#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__) +# pragma GCC diagnostic pop +#endif #include #include #include