Commit 46facaed authored by Marko Mäkelä's avatar Marko Mäkelä

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 d998da03.
parent 1cf0694d
/* /*
Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB Corporation. Copyright (c) 2009, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -6761,11 +6761,12 @@ void dbug_serve_apcs(THD *thd, int n_calls); ...@@ -6761,11 +6761,12 @@ void dbug_serve_apcs(THD *thd, int n_calls);
class ScopedStatementReplication class ScopedStatementReplication
{ {
public: public:
ScopedStatementReplication(THD *thd) : thd(thd) ScopedStatementReplication(THD *thd) :
{ saved_binlog_format(thd
if (thd) ? thd->set_current_stmt_binlog_format_stmt()
saved_binlog_format= thd->set_current_stmt_binlog_format_stmt(); : BINLOG_FORMAT_MIXED),
} thd(thd)
{}
~ScopedStatementReplication() ~ScopedStatementReplication()
{ {
if (thd) if (thd)
...@@ -6773,8 +6774,8 @@ class ScopedStatementReplication ...@@ -6773,8 +6774,8 @@ class ScopedStatementReplication
} }
private: private:
enum_binlog_format saved_binlog_format; const enum_binlog_format saved_binlog_format;
THD *thd; THD *const thd;
}; };
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment