kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject kudu git commit: [tools] fix linking error and compilation warning
Date Wed, 06 Jun 2018 02:10:35 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 76bbdd4a0 -> d6bdcff48


[tools] fix linking error and compilation warning

On some machines, when compiling with LLVM-6.0 (release configuration),
the following errors were generated:

diagnostics_log_parser.cc.o:
    src/kudu/tools/diagnostics_log_parser.h:45: multiple definition of
    `kudu::tools::RecordTypeToString(kudu::tools::RecordType)'
tool_action_diagnose.cc.o:
    src/kudu/tools/diagnostics_log_parser.h:45: first defined here

diagnostics_log_parser.cc.o: In function `operator<<':
    src/kudu/tools/diagnostics_log_parser.h:53: multiple definition of
    `kudu::tools::operator<<(std::ostream&, kudu::tools::RecordType)'
    src/kudu/tools/diagnostics_log_parser.h:53: first defined here

There was also a compilation warning:

src/kudu/tools/diagnostics_log_parser.cc:167:18:
    warning: expression result unused [-Wunused-value]
  DCHECK_NOTNULL(group);

This patch addresses the linkage error and the compilation warning.
It also has an extra petty update to move 'using' declarations outside
of the kudu::tools namespace scope.

This is a follow-up for 76bbdd4a0b6cdbbf6985504b3e6d0aa4b229b05a.

Change-Id: Iaa1ce72253e978e0aa0153993bec8562a4923e21
Reviewed-on: http://gerrit.cloudera.org:8080/10610
Reviewed-by: Andrew Wong <awong@cloudera.com>
Tested-by: Alexey Serbin <aserbin@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/d6bdcff4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/d6bdcff4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/d6bdcff4

Branch: refs/heads/master
Commit: d6bdcff48fef5d0982fe068997de188939c42f3d
Parents: 76bbdd4
Author: Alexey Serbin <aserbin@cloudera.com>
Authored: Tue Jun 5 16:16:32 2018 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Wed Jun 6 02:09:19 2018 +0000

----------------------------------------------------------------------
 src/kudu/tools/diagnostics_log_parser.cc | 28 ++++++++++++++++-----------
 src/kudu/tools/diagnostics_log_parser.h  | 13 ++-----------
 2 files changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/d6bdcff4/src/kudu/tools/diagnostics_log_parser.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/diagnostics_log_parser.cc b/src/kudu/tools/diagnostics_log_parser.cc
index 260c787..d979318 100644
--- a/src/kudu/tools/diagnostics_log_parser.cc
+++ b/src/kudu/tools/diagnostics_log_parser.cc
@@ -21,11 +21,8 @@
 #include <cstdint>
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <string>
-#include <unordered_map>
 #include <utility>
-#include <vector>
 
 #include <boost/optional/optional.hpp>
 #include <glog/logging.h>
@@ -41,20 +38,29 @@
 #include "kudu/util/jsonreader.h"
 #include "kudu/util/status.h"
 
-namespace kudu {
-namespace tools {
-
 using std::array;
-using std::cerr;
 using std::cout;
 using std::endl;
 using std::ifstream;
 using std::string;
-using std::unique_ptr;
-using std::unordered_map;
-using std::vector;
 using strings::Substitute;
 
+namespace kudu {
+namespace tools {
+
+const char* RecordTypeToString(RecordType r) {
+  switch (r) {
+    case RecordType::kStacks: return "stacks"; break;
+    case RecordType::kSymbols: return "symbols"; break;
+    case RecordType::kUnknown: return "<unknown>"; break;
+  }
+  return "<unreachable>";
+}
+
+std::ostream& operator<<(std::ostream& o, RecordType r) {
+  return o << RecordTypeToString(r);
+}
+
 void StackDumpingLogVisitor::VisitSymbol(const string& addr, const string& symbol)
{
   InsertIfNotPresent(&symbols_, addr, symbol);
 }
@@ -164,7 +170,7 @@ Status LogParser::ParseSymbols(const ParsedLine& pl) {
 
 Status LogParser::ParseStackGroup(const rapidjson::Value& group_json,
                                   StacksRecord::Group* group) {
-  DCHECK_NOTNULL(group);
+  DCHECK(group);
   StacksRecord::Group ret;
   if (PREDICT_FALSE(!group_json.IsObject())) {
     return Status::InvalidArgument("expected stacks groups to be JSON objects");

http://git-wip-us.apache.org/repos/asf/kudu/blob/d6bdcff4/src/kudu/tools/diagnostics_log_parser.h
----------------------------------------------------------------------
diff --git a/src/kudu/tools/diagnostics_log_parser.h b/src/kudu/tools/diagnostics_log_parser.h
index 2d77466..17c0648 100644
--- a/src/kudu/tools/diagnostics_log_parser.h
+++ b/src/kudu/tools/diagnostics_log_parser.h
@@ -41,18 +41,9 @@ enum class RecordType {
   kUnknown
 };
 
-const char* RecordTypeToString(RecordType r) {
-  switch (r) {
-    case RecordType::kStacks: return "stacks"; break;
-    case RecordType::kSymbols: return "symbols"; break;
-    case RecordType::kUnknown: return "<unknown>"; break;
-  }
-  return "<unreachable>";
-}
+const char* RecordTypeToString(RecordType r);
 
-std::ostream& operator<<(std::ostream& o, RecordType r) {
-  return o << RecordTypeToString(r);
-}
+std::ostream& operator<<(std::ostream& o, RecordType r);
 
 // A stack sample from the log.
 struct StacksRecord {


Mime
View raw message