Skip to content

Commit 70b25c1

Browse files
committed
Fixed warnings on MacOS(with clang)
Mostly that was removing register storage class specifier and marking methods with override.
1 parent 9db4d8b commit 70b25c1

12 files changed

+155
-145
lines changed

driver/class/ClientSidePreparedStatement.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2022 MariaDB Corporation AB
2+
Copyright (C) 2022, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -53,9 +53,9 @@ class ClientSidePreparedStatement : public PreparedStatement
5353
ClientSidePreparedStatement* clone(Protocol* connection);
5454

5555
protected:
56-
bool executeInternal(int32_t fetchSize);
57-
void executeBatchInternal(uint32_t queryParameterSize);
58-
PrepareResult* getPrepareResult();
56+
bool executeInternal(int32_t fetchSize) override;
57+
void executeBatchInternal(uint32_t queryParameterSize) override;
58+
PrepareResult* getPrepareResult() override;
5959

6060
public:
6161
Longs& executeBatch();
@@ -75,15 +75,15 @@ class ClientSidePreparedStatement : public PreparedStatement
7575
uint32_t getErrno();
7676
const char* getSqlState();
7777

78-
bool bind(MYSQL_BIND* param);
79-
bool sendLongData(uint32_t paramNum, const char* data, std::size_t length);
80-
inline bool isServerSide() const { return false; }
81-
inline enum enum_field_types getPreferredParamType(enum enum_field_types appType) const
78+
bool bind(MYSQL_BIND* param) override;
79+
bool sendLongData(uint32_t paramNum, const char* data, std::size_t length) override;
80+
inline bool isServerSide() const override { return false; }
81+
inline enum enum_field_types getPreferredParamType(enum enum_field_types appType) const override
8282
{
8383
return MYSQL_TYPE_STRING;
8484
}
85-
bool setParamCallback(ParamCodec* callback, uint32_t param) { return true; }
86-
bool setCallbackData(void* data) { return true; }
85+
bool setParamCallback(ParamCodec* callback, uint32_t param) override { return true; }
86+
bool setCallbackData(void* data) override { return true; }
8787
bool isOutParams() { return false; }
8888
//SQLString toString();
8989
};

driver/class/CmdInformationBatch.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2022 MariaDB Corporation AB
2+
Copyright (C) 2022, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -40,18 +40,18 @@ class CmdInformationBatch : public CmdInformation
4040
CmdInformationBatch(std::size_t expectedSize);
4141
~CmdInformationBatch();
4242

43-
void addErrorStat();
44-
void reset();
45-
void addResultSetStat();
46-
void addSuccessStat(int64_t updateCount);
47-
std::vector<int64_t>& getUpdateCounts();
48-
std::vector<int64_t>& getServerUpdateCounts();
49-
int64_t getUpdateCount();
50-
int32_t getCurrentStatNumber();
51-
bool moreResults();
43+
void addErrorStat() override;
44+
void reset() override;
45+
void addResultSetStat() override;
46+
void addSuccessStat(int64_t updateCount) override;
47+
std::vector<int64_t>& getUpdateCounts() override;
48+
std::vector<int64_t>& getServerUpdateCounts() override;
49+
int64_t getUpdateCount() override;
50+
int32_t getCurrentStatNumber() override;
51+
bool moreResults() override;
5252
inline uint32_t hasMoreResults() override { return 0U; }
53-
bool isCurrentUpdateCount();
54-
void setRewrite(bool rewritten);
53+
bool isCurrentUpdateCount() override;
54+
void setRewrite(bool rewritten) override;
5555
};
5656

5757
}

driver/class/CmdInformationSingle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2022 MariaDB Corporation AB
2+
Copyright (C) 2022, 2024 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public

driver/class/CmdInformationSingle.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2022 MariaDB Corporation AB
2+
Copyright (C) 2022, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -34,18 +34,18 @@ class CmdInformationSingle : public CmdInformation
3434
CmdInformationSingle(int64_t updateCount);
3535
~CmdInformationSingle();
3636

37-
std::vector<int64_t>& getUpdateCounts();
38-
std::vector<int64_t>& getServerUpdateCounts();
39-
int64_t getUpdateCount();
40-
void addErrorStat();
41-
void reset();
42-
void addResultSetStat();
43-
int32_t getCurrentStatNumber();
44-
bool moreResults();
45-
inline uint32_t hasMoreResults() override { return 0; }
46-
bool isCurrentUpdateCount();
47-
void addSuccessStat(int64_t updateCount);
48-
void setRewrite(bool rewritten);
37+
std::vector<int64_t>& getUpdateCounts() override;
38+
std::vector<int64_t>& getServerUpdateCounts() override;
39+
int64_t getUpdateCount() override;
40+
void addErrorStat() override;
41+
void reset() override;
42+
void addResultSetStat() override;
43+
int32_t getCurrentStatNumber() override;
44+
bool moreResults() override;
45+
inline uint32_t hasMoreResults() override { return 0U; }
46+
bool isCurrentUpdateCount() override;
47+
void addSuccessStat(int64_t updateCount) override;
48+
void setRewrite(bool rewritten) override;
4949
};
5050

5151
}

driver/class/ColumnDefinition.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2022 MariaDB Corporation AB
2+
Copyright (C) 2022, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -37,6 +37,9 @@ namespace mariadb
3737
switch (type) {
3838
case MARIADB_INTEGER_TYPES:
3939
return true;
40+
// to avoid warnings
41+
default:
42+
return false;
4043
}
4144
return false;
4245
}

driver/class/Protocol.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2023 MariaDB Corporation AB
2+
Copyright (C) 2023, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -1066,12 +1066,15 @@ namespace mariadb
10661066
if (!needLock || lock.try_lock()) {
10671067
//cmdPrologue();
10681068
// If connection is closed - we still need to call mysql_stmt_close to deallocate C/C stmt handle
1069-
if (mysql_stmt_close(statementId))
1070-
{
1071-
needLock && (lock.unlock(), true);
1069+
if (mysql_stmt_close(statementId)) {
1070+
if (needLock) {
1071+
lock.unlock();
1072+
}
10721073
throw SQLException("Could not deallocate query");
10731074
}
1074-
needLock && (lock.unlock(), true);
1075+
if (needLock) {
1076+
lock.unlock();
1077+
}
10751078
return true;
10761079

10771080
}

driver/class/ResultSetBin.h

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2020 MariaDB Corporation AB
2+
Copyright (C) 2020, 2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -69,8 +69,8 @@ class ResultSetBin : public ResultSet
6969

7070
~ResultSetBin();
7171

72-
bool isFullyLoaded() const;
73-
void fetchRemaining();
72+
bool isFullyLoaded() const override;
73+
void fetchRemaining() override;
7474

7575
private:
7676
void flushPendingServerResults();
@@ -82,45 +82,46 @@ class ResultSetBin : public ResultSet
8282
uint32_t warningCount();
8383

8484
private:
85-
bool readNextValue(bool cacheLocally= false);
85+
bool readNextValue(bool cacheLocally= false) override;
8686

8787
protected:
88-
std::vector<mariadb::bytes_view>& getCurrentRowData();
89-
void updateRowData(std::vector<mariadb::bytes_view>& rawData);
90-
void deleteCurrentRowData();
91-
void addRowData(std::vector<mariadb::bytes_view>& rawData);
88+
std::vector<mariadb::bytes_view>& getCurrentRowData() override;
89+
90+
void updateRowData(std::vector<mariadb::bytes_view>& rawData) override;
91+
void deleteCurrentRowData() override;
92+
void addRowData(std::vector<mariadb::bytes_view>& rawData) override;
9293

9394
private:
9495
void growDataArray(bool complete= false);
9596

9697
public:
97-
void abort();
98-
void close();
98+
void abort() override;
99+
//void close();
99100
//bool fetchNext();
100101
//SQLWarning* getWarnings();
101102
//void clearWarnings();
102103
bool isBeforeFirst() const;
103-
bool isAfterLast();
104+
bool isAfterLast() override;
104105
bool isFirst() const;
105-
bool isLast();
106-
void beforeFirst();
107-
void afterLast();
108-
bool first();
109-
bool last();
110-
int64_t getRow();
111-
bool absolute(int64_t row);
112-
bool relative(int64_t rows);
113-
bool previous();
106+
bool isLast() override;
107+
void beforeFirst() override;
108+
void afterLast() override;
109+
bool first() override;
110+
bool last() override;
111+
int64_t getRow() override;
112+
bool absolute(int64_t row) override;
113+
bool relative(int64_t rows) override;
114+
bool previous() override;
114115
int32_t getFetchSize() const;
115-
void setFetchSize(int32_t fetchSize);
116+
void setFetchSize(int32_t fetchSize);
116117
int32_t getType() const;
117118
// int32_t getConcurrency() const;
118119

119120
private:
120121
void checkClose() const;
121122

122123
public:
123-
bool isCallableResult() const;
124+
bool isCallableResult() const override;
124125
bool isClosed() const;
125126
bool wasNull() const;
126127

@@ -130,40 +131,41 @@ class ResultSetBin : public ResultSet
130131
SQLString zeroFillingIfNeeded(const SQLString& value, ColumnDefinition* columnInformation);
131132

132133
public:
133-
std::istream* getBinaryStream(int32_t columnIndex) const;
134-
int32_t getInt(int32_t columnIndex) const;
135-
int64_t getLong(int32_t columnIndex) const;
136-
uint64_t getUInt64(int32_t columnIndex) const;
137-
uint32_t getUInt(int32_t columnIndex) const;
138-
float getFloat(int32_t columnIndex) const;
139-
long double getDouble(int32_t columnIndex) const;
140-
bool getBoolean(int32_t index) const;
141-
int8_t getByte(int32_t index) const;
142-
int16_t getShort(int32_t index) const;
143-
144-
ResultSetMetaData* getMetaData() const;
134+
std::istream* getBinaryStream(int32_t columnIndex) const override;
135+
int32_t getInt(int32_t columnIndex) const override;
136+
int64_t getLong(int32_t columnIndex) const override;
137+
uint64_t getUInt64(int32_t columnIndex) const override;
138+
uint32_t getUInt(int32_t columnIndex) const override;
139+
float getFloat(int32_t columnIndex) const override;
140+
long double getDouble(int32_t columnIndex) const override;
141+
bool getBoolean(int32_t index) const override;
142+
int8_t getByte(int32_t index) const override;
143+
int16_t getShort(int32_t index) const override;
144+
145+
ResultSetMetaData* getMetaData() const override;
145146
/*Blob* getBlob(int32_t columnIndex) const;*/
146147

147-
std::size_t rowsCount() const;
148+
std::size_t rowsCount() const override;
148149

149-
void setForceTableAlias();
150+
void setForceTableAlias() override;
150151

151152
private:
152-
void rangeCheck(const SQLString& className,int64_t minValue,int64_t maxValue,int64_t value, ColumnDefinition* columnInfo);
153+
void rangeCheck(const SQLString& className,int64_t minValue,int64_t maxValue,int64_t value,
154+
ColumnDefinition* columnInfo);
153155

154156
protected:
155-
void setRowPointer(int32_t pointer);
157+
void setRowPointer(int32_t pointer) override;
156158

157159
public:
158-
int32_t getRowPointer();
159-
std::size_t getDataSize();
160-
bool isBinaryEncoded();
160+
int32_t getRowPointer() override;
161+
std::size_t getDataSize() override;
162+
bool isBinaryEncoded() override;
161163
void realClose(bool noLock= true);
162-
void bind(MYSQL_BIND* bind);
163-
bool get(MYSQL_BIND* bind, uint32_t colIdx0based, uint64_t offset);
164-
bool get();
165-
bool setResultCallback(ResultCodec* callback, uint32_t column);
166-
bool setCallbackData(void* data);
164+
void bind(MYSQL_BIND* bind) override;
165+
bool get(MYSQL_BIND* bind, uint32_t colIdx0based, uint64_t offset) override;
166+
bool get() override;
167+
bool setResultCallback(ResultCodec* callback, uint32_t column) override;
168+
bool setCallbackData(void* data) override;
167169
};
168170

169171
}

0 commit comments

Comments
 (0)