Skip to content

Commit

Permalink
Fix false-positive warnings from GCC14 when building with optimizatio…
Browse files Browse the repository at this point in the history
…ns on Fedora 40

Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
  • Loading branch information
ManManson authored and past-due committed Apr 25, 2024
1 parent 64025c9 commit db978c0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/framework/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
#include "wzapp.h"
#include <map>
#include <string>
#include <regex>
// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero
// when compiling <regex> 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 <regex>
#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__)
# pragma GCC diagnostic pop
#endif
#include <array>

#if defined(WZ_OS_LINUX) && defined(__GLIBC__)
Expand Down
11 changes: 10 additions & 1 deletion lib/ivis_opengl/gfx_api_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <regex>
// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero
// when compiling <regex> 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 <regex>
#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__)
# pragma GCC diagnostic pop
#endif
#include <limits>
#include <typeindex>
#include <sstream>
Expand Down
9 changes: 9 additions & 0 deletions src/qtscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 10 additions & 1 deletion src/urlrequest_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@
#include <algorithm>
#include <cstdio>
#include <vector>
#include <regex>
// On Fedora 40, GCC 14 produces false-positive warnings for -Walloc-zero
// when compiling <regex> 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 <regex>
#if !defined(__clang__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && __GNUC__ >= 14 && defined(__OPTIMIZE__)
# pragma GCC diagnostic pop
#endif
#include <stdlib.h>
#include <chrono>
#include <sstream>
Expand Down

0 comments on commit db978c0

Please sign in to comment.