Skip to content
Snippets Groups Projects
Commit dd6d96b7 authored by Florian Fischer's avatar Florian Fischer
Browse files

ignore maybe-uninitialized in LinkFutureTest needed by gcc 11.1.0

parent 964233cb
No related branches found
No related tags found
1 merge request!202GCC 11.1 fixes
......@@ -57,6 +57,15 @@
#define IGNORE_UNUSED_FUNCTION \
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wunused-function\"")
// test for GCC > 11.1.0
#if __GNUC__ > 11 || \
(__GNUC__ == 11 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 0)))
#define IGNORE_MAYBE_UNINITIALIZED \
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
#else
#define IGNORE_MAYBE_UNINITIALIZED _Pragma("GCC diagnostic push")
#endif
#define POP_DIAGNOSTIC _Pragma("GCC diagnostic pop")
enum class LogSubsystem {
......
......@@ -10,6 +10,7 @@
#include <cstdint> // for uint64_t, int32_t
#include "Common.hpp" // for DIE_MSG_ERRNO, DIE_MSG
#include "Debug.hpp"
#include "io.hpp"
#include "io/Future.hpp" // for ReadFuture, CloseFuture, WriteFuture
......@@ -79,7 +80,12 @@ static void successLoop() {
static void failureChainInvCor() {
std::array<char, 32> buf;
// GCC 11.1.0 reports that buf is not initialized.
// Which is totally fine because we read into it.
IGNORE_MAYBE_UNINITIALIZED
ReadFuture invalidReadFuture(-1, buf.data(), buf.size(), 0);
POP_DIAGNOSTIC
ReadFuture readFuture(0, buf.data(), buf.size(), 0);
readFuture.setDependency(invalidReadFuture);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment