Globally suppress -Wmaybe-uninitialized
We have needed to suppress it in a bunch of places because GCC has kept giving false positives depending on optimization settings. When I noticed yet another false positive when I attempted to build the game with PGO profiling data using CMake, it was the last straw. Let's just suppress the warning globally and move on with our lives.
This commit is contained in:
parent
e594815cfb
commit
0c137c79cf
6 changed files with 9 additions and 43 deletions
|
@ -295,6 +295,14 @@ check_compiler_has_flag(
|
|||
"-Wno-literal-suffix"
|
||||
)
|
||||
|
||||
# This flag is too aggressive and keeps giving false positives.
|
||||
check_compiler_has_flag(
|
||||
CXX_FLAGS_STRICT_COMPILATION
|
||||
"-Wmaybe-uninitialized"
|
||||
HAS_COMPILER_FLAG_WMAYBE_UNINITIALIZED
|
||||
"-Wno-maybe-uninitialized"
|
||||
)
|
||||
|
||||
# This removes a lot of warnings from Clang regarding unused -I arguments
|
||||
check_compiler_has_flag(
|
||||
CXX_FLAGS_STRICT_COMPILATION
|
||||
|
|
|
@ -474,7 +474,7 @@ for env in [test_env, client_env, env]:
|
|||
env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"])
|
||||
|
||||
if env['strict']:
|
||||
env.AppendUnique(CCFLAGS = Split("-Werror $(-Wno-unused-local-typedefs$)"))
|
||||
env.AppendUnique(CCFLAGS = Split("-Werror $(-Wno-unused-local-typedefs$) $(-Wno-maybe-uninitialized$)"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wold-style-cast"))
|
||||
if env['sanitize']:
|
||||
env.AppendUnique(CCFLAGS = ["-fsanitize=" + env["sanitize"]], LINKFLAGS = ["-fsanitize=" + env["sanitize"]])
|
||||
|
|
|
@ -332,17 +332,6 @@ bool listbox::update_content_size()
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Suppress -Wmaybe-uninitialized warnings.
|
||||
* @GregoryLundberg reported in IRC that GCC 6.2.1 with SCons gives a warning that the value
|
||||
* of horizontal_scrollbar_position can be used uninitialized. It's of course not possible
|
||||
* (boost::optional conversion to bool returns true only if the value is set), but GCC can't
|
||||
* prove that to itself.
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
void listbox::place(const point& origin, const point& size)
|
||||
{
|
||||
boost::optional<unsigned> vertical_scrollbar_position, horizontal_scrollbar_position;
|
||||
|
@ -375,10 +364,6 @@ void listbox::place(const point& origin, const point& size)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
void listbox::resize_content(const int width_modification,
|
||||
const int height_modification,
|
||||
const int width_modification_pos,
|
||||
|
|
|
@ -124,16 +124,6 @@ struct bad_lexical_cast : std::exception
|
|||
|
||||
namespace implementation {
|
||||
|
||||
/* Suppress -Wmaybe-uninitialized warnings.
|
||||
* I (Jyrki) noticed that building with -Og on my system (GCC 7.2.0, Boost 1.61)
|
||||
* GCC may omit a warning that the value of `fallback` may be used uninitialized.
|
||||
* It's impossible, but GCC can't prove that to itself.
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Base class for the conversion.
|
||||
*
|
||||
|
@ -495,10 +485,6 @@ struct lexical_caster<
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
#endif
|
||||
|
|
|
@ -131,13 +131,6 @@ class CVideo;
|
|||
#include "scripting/debug_lua.hpp"
|
||||
#endif
|
||||
|
||||
// Suppress uninitialized variables warnings, because of boost::optional constructors in this file which apparently confuses gcc
|
||||
#if defined(__GNUC__) && !defined(__clang__) // we shouldn't need this for clang, but for gcc and tdm-gcc we probably do
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) // "GCC diagnostic ignored" is apparently not available at version 4.5.2
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static lg::log_domain log_scripting_lua("scripting/lua");
|
||||
#define LOG_LUA LOG_STREAM(info, log_scripting_lua)
|
||||
#define WRN_LUA LOG_STREAM(warn, log_scripting_lua)
|
||||
|
|
|
@ -43,12 +43,6 @@
|
|||
|
||||
#include "utils/functional.hpp"
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__WIN32__) // We only want this for gcc, not clang or tdm-gcc
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8 )
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" //Suppress uninitialized variables warnings on GCC <= 4.8.x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
template <uint32_t N> inline
|
||||
|
|
Loading…
Add table
Reference in a new issue