Skip to content

Commit

Permalink
Fixed build with Clang (vesoft-inc#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
dutor authored Sep 23, 2019
1 parent 7b19376 commit d3cede3
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 32 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if (!CMAKE_CXX_COMPILER)
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -no-pie")

Expand Down
12 changes: 7 additions & 5 deletions cmake/FindPCHSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Macro:
# ADD_PRECOMPILED_HEADER

IF(CMAKE_COMPILER_IS_GNUCXX)
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
EXEC_PROGRAM(
${CMAKE_CXX_COMPILER}
ARGS --version
Expand All @@ -20,13 +20,15 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
IF(gcc_compiler_version MATCHES "[4-9]\\.[0-9]\\.[0-9]")
SET(PCHSupport_FOUND TRUE)
MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version})
ELSE(gcc_compiler_version MATCHES "[4-9]\\.[0-9]\\.[0-9]")
ELSE()
IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
SET(PCHSupport_FOUND TRUE)
MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version})
ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
ENDIF(gcc_compiler_version MATCHES "[4-9]\\.[0-9]\\.[0-9]")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
ENDIF()
ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
SET(PCHSupport_FOUND TRUE)
ENDIF()



Expand Down
24 changes: 12 additions & 12 deletions src/common/filter/Expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,17 +684,17 @@ const char* UnaryExpression::decode(const char *pos, const char *end) {

std::string columnTypeToString(ColumnType type) {
switch (type) {
case INT:
case ColumnType::INT:
return "int";
case STRING:
case ColumnType::STRING:
return "string";
case DOUBLE:
case ColumnType::DOUBLE:
return "double";
case BIGINT:
case ColumnType::BIGINT:
return "bigint";
case BOOL:
case ColumnType::BOOL:
return "bool";
case TIMESTAMP:
case ColumnType::TIMESTAMP:
return "timestamp";
default:
return "unknown";
Expand Down Expand Up @@ -722,16 +722,16 @@ OptVariantType TypeCastingExpression::eval() const {
}

switch (type_) {
case INT:
case TIMESTAMP:
case ColumnType::INT:
case ColumnType::TIMESTAMP:
return Expression::toInt(result.value());
case STRING:
case ColumnType::STRING:
return Expression::toString(result.value());
case DOUBLE:
case ColumnType::DOUBLE:
return Expression::toDouble(result.value());
case BOOL:
case ColumnType::BOOL:
return Expression::toBool(result.value());
case BIGINT:
case ColumnType::BIGINT:
return Status::Error("Type bigint not supported yet");
}
LOG(FATAL) << "casting to unknown type: " << static_cast<int>(type_);
Expand Down
2 changes: 1 addition & 1 deletion src/common/filter/Expressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace nebula {
class Cord;
using OptVariantType = StatusOr<VariantType>;

enum ColumnType {
enum class ColumnType {
INT, STRING, DOUBLE, BIGINT, BOOL, TIMESTAMP,
};

Expand Down
10 changes: 5 additions & 5 deletions src/graph/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@ StatusOr<int64_t> Executor::toTimestamp(const VariantType &value) {

nebula::cpp2::SupportedType Executor::ColumnTypeToSupportedType(ColumnType type) const {
switch (type) {
case INT:
case ColumnType::INT:
return nebula::cpp2::SupportedType::INT;
case STRING:
case ColumnType::STRING:
return nebula::cpp2::SupportedType::STRING;
case DOUBLE:
case ColumnType::DOUBLE:
return nebula::cpp2::SupportedType::DOUBLE;
case BOOL:
case ColumnType::BOOL:
return nebula::cpp2::SupportedType::BOOL;
case TIMESTAMP:
case ColumnType::TIMESTAMP:
return nebula::cpp2::SupportedType::TIMESTAMP;
default:
LOG(ERROR) << "Unknown type: " << static_cast<int32_t>(type);
Expand Down
4 changes: 2 additions & 2 deletions src/graph/InterimResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class InterimResult final {
public:
InterimResult() = default;
~InterimResult() = default;
InterimResult(const InterimResult &) = default;
InterimResult& operator=(const InterimResult &) = default;
InterimResult(const InterimResult &) = delete;
InterimResult& operator=(const InterimResult &) = delete;
InterimResult(InterimResult &&) = default;
InterimResult& operator=(InterimResult &&) = default;

Expand Down
10 changes: 5 additions & 5 deletions src/graph/SchemaHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ namespace graph {
// static
nebula::cpp2::SupportedType SchemaHelper::columnTypeToSupportedType(ColumnType type) {
switch (type) {
case BOOL:
case ColumnType::BOOL:
return nebula::cpp2::SupportedType::BOOL;
case INT:
case ColumnType::INT:
return nebula::cpp2::SupportedType::INT;
case DOUBLE:
case ColumnType::DOUBLE:
return nebula::cpp2::SupportedType::DOUBLE;
case STRING:
case ColumnType::STRING:
return nebula::cpp2::SupportedType::STRING;
case TIMESTAMP:
case ColumnType::TIMESTAMP:
return nebula::cpp2::SupportedType::TIMESTAMP;
default:
return nebula::cpp2::SupportedType::UNKNOWN;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/UpdateEdgeProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ std::string UpdateEdgeProcessor::updateAndWriteBack() {
}

std::vector<kvstore::KV> data;
data.emplace_back(key_, std::move(updater_->encode()));
data.emplace_back(key_, updater_->encode());
auto log = kvstore::encodeMultiValues(kvstore::OP_MULTI_PUT, data);
return log;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/UpdateVertexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ std::string UpdateVertexProcessor::updateAndWriteBack() {
std::vector<kvstore::KV> data;
for (const auto& u : tagUpdaters_) {
data.emplace_back(std::move(u.second->key),
std::move(u.second->updater->encode()));
u.second->updater->encode());
}
auto log = kvstore::encodeMultiValues(kvstore::OP_MULTI_PUT, data);
return log;
Expand Down

0 comments on commit d3cede3

Please sign in to comment.