Skip to content

Commit 34dd242

Browse files
committed
PS-9217: Merge MySQL 8.0.37 Fix warnings with gcc-14
https://perconadev.atlassian.net/browse/PS-9217
1 parent 89a18a5 commit 34dd242

File tree

18 files changed

+57
-50
lines changed

18 files changed

+57
-50
lines changed

libbinlogevents/include/binlog_event.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,14 @@ class Log_event_header {
730730
@return True if the event object is valid, false otherwise.
731731
*/
732732

733+
#if defined(__GNUC__) && (__GNUC__ >= 14)
734+
#pragma GCC diagnostic push
735+
#pragma GCC diagnostic ignored "-Wuninitialized"
736+
#endif
733737
bool get_is_valid() { return m_is_valid; }
738+
#if defined(__GNUC__) && (__GNUC__ >= 14)
739+
#pragma GCC diagnostic pop
740+
#endif
734741

735742
/**
736743
Set if the event object shall be considered valid or not.

plugin/audit_log_filter/event_filter_function/query_digest.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ template <>
2626
class EventFilterFunction<EventFilterFunctionType::QueryDigest>
2727
: public EventFilterFunctionBase {
2828
public:
29-
explicit EventFilterFunction<EventFilterFunctionType::QueryDigest>(
30-
FunctionArgsList args);
29+
explicit EventFilterFunction(FunctionArgsList args);
3130

3231
/**
3332
* @brief Validate function arguments.

plugin/audit_log_filter/event_filter_function/string_find.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ template <>
2424
class EventFilterFunction<EventFilterFunctionType::StringFind>
2525
: public EventFilterFunctionBase {
2626
public:
27-
explicit EventFilterFunction<EventFilterFunctionType::StringFind>(
28-
FunctionArgsList args);
27+
explicit EventFilterFunction(FunctionArgsList args);
2928

3029
/**
3130
* @brief Validate function arguments.

plugin/audit_log_filter/log_writer/file.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ using FileWriterPtr = std::unique_ptr<FileWriterBase>;
3131
template <>
3232
class LogWriter<AuditLogHandlerType::File> : public LogWriterBase {
3333
public:
34-
LogWriter<AuditLogHandlerType::File>() = delete;
35-
explicit LogWriter<AuditLogHandlerType::File>(
34+
LogWriter() = delete;
35+
explicit LogWriter(
3636
std::unique_ptr<log_record_formatter::LogRecordFormatterBase> formatter);
37-
~LogWriter<AuditLogHandlerType::File>() override;
37+
~LogWriter() override;
3838

3939
/**
4040
* @brief Init log writer.

plugin/percona-pam-for-mysql/src/auth_pam_common.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int vio_server_conv(int num_msg, const struct pam_message **msg,
8080
return PAM_CONV_ERR;
8181
}
8282

83-
*resp = (struct pam_response *)calloc(sizeof(struct pam_response), num_msg);
83+
*resp = (struct pam_response *)calloc(num_msg, sizeof(struct pam_response));
8484
if (*resp == nullptr) return PAM_BUF_ERR;
8585

8686
void *talk_data;

router/tests/component/test_routing_strategy.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ TEST_P(RouterRoutingStrategyMetadataCache, MetadataCacheRoutingStrategy) {
413413
ASSERT_NO_FATAL_FAILURE(
414414
connect_client_and_query_port(router_port, node_port));
415415
if (i == 0) { // first-connection
416-
const auto &real_port_iter =
416+
const auto real_port_iter =
417417
std::find(cluster_nodes_ports.begin(), cluster_nodes_ports.end(),
418418
static_cast<uint16_t>(std::atoi(node_port.c_str())));
419419
ASSERT_NE(real_port_iter, cluster_nodes_ports.end());

sql/auth/acl_table_user.cc

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,32 +2074,6 @@ bool Acl_table_user_reader::driver() {
20742074
Password_lock::Password_lock()
20752075
: password_lock_time_days(0), failed_login_attempts(0) {}
20762076

2077-
Password_lock &Password_lock::operator=(const Password_lock &other) {
2078-
if (this != &other) {
2079-
password_lock_time_days = other.password_lock_time_days;
2080-
failed_login_attempts = other.failed_login_attempts;
2081-
}
2082-
return *this;
2083-
}
2084-
2085-
Password_lock &Password_lock::operator=(Password_lock &&other) {
2086-
if (this != &other) {
2087-
std::swap(password_lock_time_days, other.password_lock_time_days);
2088-
std::swap(failed_login_attempts, other.failed_login_attempts);
2089-
}
2090-
return *this;
2091-
}
2092-
2093-
Password_lock::Password_lock(const Password_lock &other) {
2094-
password_lock_time_days = other.password_lock_time_days;
2095-
failed_login_attempts = other.failed_login_attempts;
2096-
}
2097-
2098-
Password_lock::Password_lock(Password_lock &&other) {
2099-
std::swap(password_lock_time_days, other.password_lock_time_days);
2100-
std::swap(failed_login_attempts, other.failed_login_attempts);
2101-
}
2102-
21032077
} // namespace acl_table
21042078

21052079
/**

sql/auth/acl_table_user.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ struct Password_lock {
7373

7474
Password_lock();
7575

76-
Password_lock &operator=(const Password_lock &other);
77-
78-
Password_lock &operator=(Password_lock &&other);
79-
80-
Password_lock(const Password_lock &other);
81-
82-
Password_lock(Password_lock &&other);
8376
};
8477

8578
/**

sql/log_event.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,18 @@ Log_event::Log_event(Log_event_header *header, Log_event_footer *footer)
10101010
common_footer(footer) {
10111011
#ifdef MYSQL_SERVER
10121012
thd = nullptr;
1013+
#endif
1014+
#if defined(__GNUC__) && (__GNUC__ >= 14)
1015+
#pragma GCC diagnostic push
1016+
#pragma GCC diagnostic ignored "-Wuninitialized"
10131017
#endif
10141018
/*
10151019
Mask out any irrelevant parts of the server_id
10161020
*/
10171021
server_id = common_header->unmasked_server_id & opt_server_id_mask;
1022+
#if defined(__GNUC__) && (__GNUC__ >= 14)
1023+
#pragma GCC diagnostic pop
1024+
#endif
10181025
}
10191026

10201027
/*
@@ -7977,6 +7984,10 @@ Rows_log_event::Rows_log_event(
79777984
for UPDATE_ROWS_EVENTS, else it is equal to the before image.
79787985
*/
79797986
/* if bitmap_init fails, is_valid will be set to false */
7987+
#if defined(__GNUC__) && (__GNUC__ >= 14)
7988+
#pragma GCC diagnostic push
7989+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
7990+
#endif
79807991
if (likely(!bitmap_init(&m_cols,
79817992
m_width <= sizeof(m_bitbuf) * 8 ? m_bitbuf : nullptr,
79827993
m_width))) {
@@ -7996,6 +8007,9 @@ Rows_log_event::Rows_log_event(
79968007
common_header->set_is_valid(false);
79978008
return;
79988009
}
8010+
#if defined(__GNUC__) && (__GNUC__ >= 14)
8011+
#pragma GCC diagnostic pop
8012+
#endif
79998013
m_cols_ai.bitmap =
80008014
m_cols.bitmap; // See explanation below while setting is_valid.
80018015

sql/sql_bitmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ class Bitmap<64> {
139139
ulonglong map;
140140

141141
public:
142-
Bitmap<64>() { init(); }
142+
Bitmap() { init(); }
143143
enum { ALL_BITS = 64 };
144144

145-
explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); }
145+
explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); }
146146
void init() { clear_all(); }
147147
void init(uint prefix_to_set) { set_prefix(prefix_to_set); }
148148
uint length() const { return 64; }

sql/sql_planner.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@ void Optimize_table_order::best_access_path(JOIN_TAB *tab,
10851085
choose it over ALL/index, there is no need to consider a full table
10861086
scan.
10871087
*/
1088+
#if defined(__GNUC__) && (__GNUC__ >= 14)
1089+
#pragma GCC diagnostic push
1090+
#pragma GCC diagnostic ignored "-Warray-bounds"
1091+
#endif
10881092
if (rows_fetched < tab->found_records && // (1a)
10891093
best_read_cost <= tab->read_time) // (1b)
10901094
{
@@ -1190,6 +1194,9 @@ void Optimize_table_order::best_access_path(JOIN_TAB *tab,
11901194

11911195
trace_access_scan.add("chosen", best_ref == nullptr);
11921196
}
1197+
#if defined(__GNUC__) && (__GNUC__ >= 14)
1198+
#pragma GCC diagnostic pop
1199+
#endif
11931200

11941201
/*
11951202
Storage engines that track exact sizes may report an empty table

sql/stream_cipher.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ bool Aes_ctr_cipher<TYPE>::open(const Key_string &password, int header_size) {
6969
}
7070

7171
template <Cipher_type TYPE>
72-
Aes_ctr_cipher<TYPE>::~Aes_ctr_cipher<TYPE>() {
72+
Aes_ctr_cipher<TYPE>::~Aes_ctr_cipher() {
7373
close();
7474
}
7575

storage/ndb/src/ndbapi/Ndb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ int Ndb::computeHash(Uint32 *retval, const NdbDictionary::Table *table,
440440
while (true) {
441441
if (buf == nullptr) {
442442
bufLen = sumlen;
443-
buf = malloc(bufLen);
443+
buf = calloc(bufLen, 1);
444444
if (unlikely(buf == nullptr)) return 4000;
445445
malloced_buf = buf; /* Remember to free */
446446
}

storage/ndb/tools/NdbImportUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ void NdbImportUtil::free_rows(RowList &src) {
13321332
NdbImportUtil::Blob::Blob() {
13331333
m_blobsize = 0;
13341334
m_allocsize = 0;
1335-
m_data = new uchar[0];
1335+
m_data = new uchar[1];
13361336
}
13371337

13381338
NdbImportUtil::Blob::~Blob() { delete[] m_data; }

storage/perfschema/pfs_buffer_container.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ class PFS_buffer_scalable_iterator {
969969
template <class T>
970970
class PFS_buffer_processor {
971971
public:
972-
virtual ~PFS_buffer_processor<T>() = default;
972+
virtual ~PFS_buffer_processor() = default;
973973
virtual void operator()(T *element) = 0;
974974
};
975975

storage/perfschema/pfs_name.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class Field;
4545
template <int max_length>
4646
struct PFS_any_name {
4747
public:
48-
PFS_any_name<max_length>() { m_length = 0; }
48+
PFS_any_name() { m_length = 0; }
4949

50-
PFS_any_name<max_length>(const PFS_any_name<max_length> &other) {
50+
PFS_any_name(const PFS_any_name<max_length> &other) {
5151
assert(other.m_length <= max_length);
5252

5353
if (0 < other.m_length && other.m_length <= max_length) {

testclients/mysql_client_test.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,15 @@ static void mct_start_logging(const char *test_case_name) {
484484
return;
485485
}
486486

487+
#if defined(__GNUC__) && (__GNUC__ >= 14)
488+
#pragma GCC diagnostic push
489+
#pragma GCC diagnostic ignored "-Wformat-truncation"
490+
#endif
487491
snprintf(mct_log_file_path, FILE_PATH_SIZE, "%s/%s.out.log",
488492
(const char *)tmp_dir, (const char *)test_case_name);
493+
#if defined(__GNUC__) && (__GNUC__ >= 14)
494+
#pragma GCC diagnostic pop
495+
#endif
489496

490497
mct_log_file =
491498
my_fopen(mct_log_file_path, O_WRONLY | MY_FOPEN_BINARY, MYF(MY_WME));

unittest/gunit/hypergraph_optimizer-t.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6508,7 +6508,14 @@ struct CountingReceiver {
65086508
return false;
65096509
}
65106510

6511+
#if defined(__GNUC__) && (__GNUC__ >= 14)
6512+
#pragma GCC diagnostic push
6513+
#pragma GCC diagnostic ignored "-Warray-bounds"
6514+
#endif
65116515
size_t count(NodeMap map) const { return m_num_subplans[map]; }
6516+
#if defined(__GNUC__) && (__GNUC__ >= 14)
6517+
#pragma GCC diagnostic pop
6518+
#endif
65126519

65136520
const JoinHypergraph &m_graph;
65146521
std::unique_ptr<size_t[]> m_num_subplans;

0 commit comments

Comments
 (0)