diff --git a/io/misc.cpp b/io/misc.cpp index 61f9cdd..25114d5 100644 --- a/io/misc.cpp +++ b/io/misc.cpp @@ -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(file)), istreambuf_iterator()); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif return res; } diff --git a/tests/iotests.cpp b/tests/iotests.cpp index d3f4919..3da0587 100644 --- a/tests/iotests.cpp +++ b/tests/iotests.cpp @@ -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(inputFile)), istreambuf_iterator()); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif CPPUNIT_ASSERT_EQUAL(originalContents, newFile.str()); }