Ignore warning about possible null pointer dereferences appearing with GCC 12
Not sure why this warning is occurring but it is likely incorrect
This commit is contained in:
parent
f46855b130
commit
c1152ca062
|
@ -37,7 +37,14 @@ std::string readFile(std::string_view path, std::string_view::size_type maxSize)
|
|||
}
|
||||
res.reserve(size);
|
||||
file.seekg(ios_base::beg);
|
||||
// ignore warning about null pointer dereference from GCC 12 for now (which is *likely* not correct)
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
#endif
|
||||
res.assign((istreambuf_iterator<char>(file)), istreambuf_iterator<char>());
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -446,7 +446,14 @@ void IoTests::testAdvancedIniFile()
|
|||
std::string originalContents;
|
||||
inputFile.clear();
|
||||
inputFile.seekg(std::ios_base::beg);
|
||||
// ignore warning about null pointer dereference from GCC 12 for now (which is *likely* not correct)
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
#endif
|
||||
originalContents.assign((istreambuf_iterator<char>(inputFile)), istreambuf_iterator<char>());
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
CPPUNIT_ASSERT_EQUAL(originalContents, newFile.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue