-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PS-9218: Merge MySQL 8.4.0 (fix gcc-14 build) #5309
PS-9218: Merge MySQL 8.4.0 (fix gcc-14 build) #5309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
@@ -440,7 +440,7 @@ int Ndb::computeHash(Uint32 *retval, const NdbDictionary::Table *table, | |||
while (true) { | |||
if (buf == nullptr) { | |||
bufLen = sumlen; | |||
buf = malloc(bufLen); | |||
buf = calloc(bufLen, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assigning newly created gsl::owner<>
to non-owner void *
@@ -440,7 +440,7 @@ | |||
while (true) { | |||
if (buf == nullptr) { | |||
bufLen = sumlen; | |||
buf = malloc(bufLen); | |||
buf = calloc(bufLen, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to calloc
has an allocation size of 0 bytes
@@ -440,7 +440,7 @@ | |||
while (true) { | |||
if (buf == nullptr) { | |||
bufLen = sumlen; | |||
buf = malloc(bufLen); | |||
buf = calloc(bufLen, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not manage memory manually; consider a container or a smart pointer
Please try to compile in RelWithDebInfo mode - there are more warnings. |
09a31a9
to
f471726
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
|
||
if (!mct_log_file) { | ||
printf("Warning: can not open log file (%s): %s. Logging is disabled.\n", | ||
(const char *)mct_log_file_path, (const char *)strerror(errno)); | ||
mct_log_file_path.str().c_str(), (const char *)strerror(errno)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast
@@ -1332,7 +1332,7 @@ void NdbImportUtil::free_rows(RowList &src) { | |||
NdbImportUtil::Blob::Blob() { | |||
m_blobsize = 0; | |||
m_allocsize = 0; | |||
m_data = new uchar[0]; | |||
m_data = new uchar[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assigning newly created gsl::owner<>
to non-owner uchar *
(aka unsigned char *
)
@@ -1332,7 +1332,7 @@ | |||
NdbImportUtil::Blob::Blob() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_data
should be initialized in a member initializer of the constructor
NdbImportUtil::Blob::Blob() { | |
NdbImportUtil::Blob::Blob(), m_data(new uchar[1]) { |
@@ -1332,7 +1332,7 @@ | |||
NdbImportUtil::Blob::Blob() { | |||
m_blobsize = 0; | |||
m_allocsize = 0; | |||
m_data = new uchar[0]; | |||
m_data = new uchar[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_data
should be initialized in a member initializer of the constructor
m_data = new uchar[1]; | |
snprintf(mct_log_file_path, FILE_PATH_SIZE, "%s/%s.out.log", | ||
(const char *)tmp_dir, (const char *)test_case_name); | ||
std::stringstream mct_log_file_path; | ||
mct_log_file_path << tmp_dir << "/" << test_case_name << ".out.log"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is C++20, consider using std::format
:
const std::string str = std::format("{}/{}.out.log", tmp_dir, test_case_name);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this idea but I'm afraid not all expected compilers support it
f471726
to
88d7f2a
Compare
88d7f2a
to
5f03663
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
7f4b4fd
into
percona:release-8.4.0-1
https://perconadev.atlassian.net/browse/PS-9218