Skip to content

Commit

Permalink
Fix GCC 9 -Wmaybe-uninitialized
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Sep 26, 2019
1 parent 1cf0694 commit 46facae
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -6761,20 +6761,21 @@ 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)
thd->restore_stmt_binlog_format(saved_binlog_format);
}

private:
enum_binlog_format saved_binlog_format;
THD *thd;
const enum_binlog_format saved_binlog_format;
THD *const thd;
};

#endif /* MYSQL_SERVER */
Expand Down

0 comments on commit 46facae

Please sign in to comment.