From 9892e3859f8c20ce616a4553eccf22d9f1bcb372 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 23 Jun 2014 13:06:27 +0400 Subject: [PATCH] Disabled 'may be used uninitialized' warnings for gcc caused by boost::optional. --- src/init_from_settings.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/init_from_settings.cpp b/src/init_from_settings.cpp index 053585f..9d8fb19 100644 --- a/src/init_from_settings.cpp +++ b/src/init_from_settings.cpp @@ -15,6 +15,14 @@ #ifndef BOOST_LOG_WITHOUT_SETTINGS_PARSERS +#if defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \ + && (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 +// This warning is caused by a compiler bug which is exposed when boost::optional is used: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679 +// It has to be disabled here, before any code is included, since otherwise it doesn't help and the warning is still emitted. +// ‘*((void*)& foo +2)’ may be used uninitialized in this function +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include "windows_version.hpp" #include #include