Skip to content

Commit 46facae

Browse files
committed
Fix GCC 9 -Wmaybe-uninitialized
Always initialize ScopedStatementReplication::saved_binlog_format, so that GCC cannot emit a bogus warning about ScopedStatementReplication::~ScopedStatementReplication() using the variable. The code was originally introduced in commit d998da0.
1 parent 1cf0694 commit 46facae

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sql/sql_class.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
3-
Copyright (c) 2009, 2017, MariaDB Corporation.
3+
Copyright (c) 2009, 2019, MariaDB Corporation.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -6761,20 +6761,21 @@ void dbug_serve_apcs(THD *thd, int n_calls);
67616761
class ScopedStatementReplication
67626762
{
67636763
public:
6764-
ScopedStatementReplication(THD *thd) : thd(thd)
6765-
{
6766-
if (thd)
6767-
saved_binlog_format= thd->set_current_stmt_binlog_format_stmt();
6768-
}
6764+
ScopedStatementReplication(THD *thd) :
6765+
saved_binlog_format(thd
6766+
? thd->set_current_stmt_binlog_format_stmt()
6767+
: BINLOG_FORMAT_MIXED),
6768+
thd(thd)
6769+
{}
67696770
~ScopedStatementReplication()
67706771
{
67716772
if (thd)
67726773
thd->restore_stmt_binlog_format(saved_binlog_format);
67736774
}
67746775

67756776
private:
6776-
enum_binlog_format saved_binlog_format;
6777-
THD *thd;
6777+
const enum_binlog_format saved_binlog_format;
6778+
THD *const thd;
67786779
};
67796780

67806781
#endif /* MYSQL_SERVER */

0 commit comments

Comments
 (0)