summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-26 15:18:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-26 15:43:51 +0300
commit46facaedbffe8031f249fb7ecfe114273023fc66 (patch)
treec199fefa4f882a3fbb7bcefe0a5a0b0135c36b66
parent1cf0694d10cbeee0281e71297d9363ce786b67e4 (diff)
downloadmariadb-git-46facaedbffe8031f249fb7ecfe114273023fc66.tar.gz
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 d998da03069dca1aae83ec6af7eb407bbdc9fc58.
-rw-r--r--sql/sql_class.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9bd486a540e..19f7265b24d 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1,6 +1,6 @@
/*
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
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);
class ScopedStatementReplication
{
public:
- ScopedStatementReplication(THD *thd) : thd(thd)
- {
- if (thd)
- saved_binlog_format= thd->set_current_stmt_binlog_format_stmt();
- }
+ ScopedStatementReplication(THD *thd) :
+ saved_binlog_format(thd
+ ? thd->set_current_stmt_binlog_format_stmt()
+ : BINLOG_FORMAT_MIXED),
+ thd(thd)
+ {}
~ScopedStatementReplication()
{
if (thd)
@@ -6773,8 +6774,8 @@ public:
}
private:
- enum_binlog_format saved_binlog_format;
- THD *thd;
+ const enum_binlog_format saved_binlog_format;
+ THD *const thd;
};
#endif /* MYSQL_SERVER */