You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/02/20 18:29:39 UTC
[kudu] 01/03: Fix some compilation warnings
This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit aca61daa38f49be977315fd2dbb021f1b085f848
Author: Yingchun Lai <40...@qq.com>
AuthorDate: Tue Feb 19 10:04:26 2019 -0500
Fix some compilation warnings
Fix compilation warnings on CentOS 7.3 with
gcc 4.8.5, and Ubuntu 18.04 with gcc 7.3.0
Change-Id: Ia11e3a3ec1b81332aac0b1c841a78d9fb145c33d
Reviewed-on: http://gerrit.cloudera.org:8080/12522
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
src/kudu/common/row_changelist.cc | 2 +-
src/kudu/common/row_changelist.h | 2 +-
src/kudu/consensus/consensus_queue.cc | 4 ++++
src/kudu/consensus/log_util.cc | 2 +-
src/kudu/tablet/deltafile.cc | 2 +-
src/kudu/util/env_posix.cc | 4 ++--
src/kudu/util/logging.cc | 3 ++-
7 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/kudu/common/row_changelist.cc b/src/kudu/common/row_changelist.cc
index b08ded1..5681439 100644
--- a/src/kudu/common/row_changelist.cc
+++ b/src/kudu/common/row_changelist.cc
@@ -223,7 +223,7 @@ Status RowChangeListDecoder::MutateRowAndCaptureChanges(RowBlockRow* dst_row,
DecodedUpdate dec;
RETURN_NOT_OK(DecodeNext(&dec));
int col_idx;
- const void* value;
+ const void* value = nullptr;
RETURN_NOT_OK(dec.Validate(*dst_schema, &col_idx, &value));
// Reinserts don't update keys so they shouldn't include the key columns.
DCHECK(!dst_schema->is_key_column(col_idx));
diff --git a/src/kudu/common/row_changelist.h b/src/kudu/common/row_changelist.h
index a2b36e8..e415c27 100644
--- a/src/kudu/common/row_changelist.h
+++ b/src/kudu/common/row_changelist.h
@@ -380,7 +380,7 @@ class RowChangeListDecoder {
ColumnId col_id;
// If true, this update sets the given column to NULL.
- bool null;
+ bool null = false;
// The "raw" value of the updated column.
// - in the case of a fixed length type such as an integer,
diff --git a/src/kudu/consensus/consensus_queue.cc b/src/kudu/consensus/consensus_queue.cc
index 383a5cd..41815ad 100644
--- a/src/kudu/consensus/consensus_queue.cc
+++ b/src/kudu/consensus/consensus_queue.cc
@@ -1259,7 +1259,11 @@ bool PeerMessageQueue::ResponseFromPeer(const std::string& peer_uuid,
}
if (mode_copy == LEADER && updated_commit_index != boost::none) {
+ // Suppress false positive about 'updated_commit_index' used when uninitialized.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
NotifyObserversOfCommitIndexChange(*updated_commit_index);
+#pragma GCC diagnostic pop
}
return send_more_immediately;
diff --git a/src/kudu/consensus/log_util.cc b/src/kudu/consensus/log_util.cc
index 3680fd3..27c143b 100644
--- a/src/kudu/consensus/log_util.cc
+++ b/src/kudu/consensus/log_util.cc
@@ -486,7 +486,7 @@ Status ReadableLogSegment::ParseHeaderMagicAndHeaderLength(const Slice &data,
}
Status ReadableLogSegment::ReadFooter() {
- uint32_t footer_size;
+ uint32_t footer_size = 0;
RETURN_NOT_OK(ReadFooterMagicAndFooterLength(&footer_size));
if (footer_size == 0 || footer_size > kLogSegmentMaxHeaderOrFooterSize) {
diff --git a/src/kudu/tablet/deltafile.cc b/src/kudu/tablet/deltafile.cc
index 9d5bc01..e6b7a0a 100644
--- a/src/kudu/tablet/deltafile.cc
+++ b/src/kudu/tablet/deltafile.cc
@@ -558,7 +558,7 @@ Status DeltaFileIterator<Type>::PrepareBatch(size_t nrows, int prepare_flags) {
}
while (!exhausted_) {
- rowid_t next_block_rowidx;
+ rowid_t next_block_rowidx = 0;
RETURN_NOT_OK(GetFirstRowIndexInCurrentBlock(&next_block_rowidx));
VLOG(2) << "Current delta block starting at row " << next_block_rowidx;
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index b6215f8..5d1e55c 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -1126,7 +1126,7 @@ class PosixEnv : public Env {
string* created_filename,
unique_ptr<WritableFile>* result) OVERRIDE {
TRACE_EVENT1("io", "PosixEnv::NewTempWritableFile", "template", name_template);
- int fd;
+ int fd = 0;
string tmp_filename;
RETURN_NOT_OK(MkTmpFile(name_template, &fd, &tmp_filename));
RETURN_NOT_OK(InstantiateNewWritableFile(tmp_filename, fd, opts, result));
@@ -1152,7 +1152,7 @@ class PosixEnv : public Env {
virtual Status NewTempRWFile(const RWFileOptions& opts, const string& name_template,
string* created_filename, unique_ptr<RWFile>* res) OVERRIDE {
TRACE_EVENT1("io", "PosixEnv::NewTempRWFile", "template", name_template);
- int fd;
+ int fd = 0;
RETURN_NOT_OK(MkTmpFile(name_template, &fd, created_filename));
res->reset(new PosixRWFile(*created_filename, fd, opts.sync_on_close));
return Status::OK();
diff --git a/src/kudu/util/logging.cc b/src/kudu/util/logging.cc
index fcf035f..cfda466 100644
--- a/src/kudu/util/logging.cc
+++ b/src/kudu/util/logging.cc
@@ -31,6 +31,7 @@
#include <gflags/gflags.h>
#include <glog/logging.h>
+#include "kudu/gutil/basictypes.h"
#include "kudu/gutil/callback.h" // IWYU pragma: keep
#include "kudu/gutil/port.h"
#include "kudu/gutil/spinlock.h"
@@ -174,7 +175,7 @@ void FlushCoverageOnExit() {
static std::once_flag once;
std::call_once(once, [] {
static const char msg[] = "Flushing coverage data before crash...\n";
- write(STDERR_FILENO, msg, arraysize(msg));
+ ignore_result(write(STDERR_FILENO, msg, arraysize(msg)));
TryFlushCoverage();
});
in_call = false;