Fix MinGW build error (#4935) (#5127)

This commit fixes the following build error when the source code is build
with MinGW gcc 12 and compiler switch '-Werror=maybe-uninitialized' is
added:

    'file.{anonymous}::OutputFile::old_mode_' may be used uninitialized
     in this function [-Werror=maybe-uninitialized]
This commit is contained in:
Ralf Habacker 2023-03-03 16:53:08 +01:00 committed by GitHub
parent bd83b772c3
commit 3eff21366e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,7 +127,7 @@ class OutputFile {
public:
// Opens |filename| in the given mode. If |filename| is nullptr, the empty
// string or "-", stdout will be set to the given mode.
OutputFile(const char* filename, const char* mode) {
OutputFile(const char* filename, const char* mode) : old_mode_(0) {
const bool use_stdout =
!filename || (filename[0] == '-' && filename[1] == '\0');
if (use_stdout) {