Skip to content

Commit

Permalink
Fix clang build. (vesoft-inc#2358)
Browse files Browse the repository at this point in the history
Co-authored-by: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com>
Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 29, 2020
1 parent 21ad248 commit b7582e2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/FindNCURSES.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(NCURSES_INCLUDE_DIR AND NCURSES_LIBRARY_DIR)
else()
FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ncurses DEFAULT_MSG NCURSES_INCLUDE_DIR NCURSES_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NCURSES DEFAULT_MSG NCURSES_INCLUDE_DIR NCURSES_LIBRARY)
endif()

mark_as_advanced(
Expand Down
4 changes: 2 additions & 2 deletions src/common/base/EitherOr.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ class EitherOr {
};

template<class... Args>
static constexpr auto convert_to_t = TypeConverter<Args...>::type;
static constexpr decltype(TypeConverter<Args...>::type) convert_to_t{};

template<class... Args>
static constexpr auto convert_to_s = TypeConverter<Args...>::state;
static constexpr State convert_to_s = TypeConverter<Args...>::state;

public:
virtual ~EitherOr() {
Expand Down
6 changes: 3 additions & 3 deletions src/common/base/StatusOr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class StatusOr final {

// Convenience type traits
template <typename U>
static constexpr auto is_status_v = std::is_same<Status, std::decay_t<U>>::value;
static constexpr bool is_status_v = std::is_same<Status, std::decay_t<U>>::value;

// Tell if `U' is of type `StatusOr<V>'
template <typename U>
Expand All @@ -33,7 +33,7 @@ class StatusOr final {
};

template <typename U>
static constexpr auto is_status_or_v = is_status_or<U>::value;
static constexpr bool is_status_or_v = is_status_or<U>::value;

// Tell if `T' is initializable from `U'.
// We simply use `is_constructible_v' for now,
Expand All @@ -43,7 +43,7 @@ class StatusOr final {
// TODO(dutor) we may take other cases into account in future,
// e.g. convertible but not constructible.
template <typename U>
static constexpr auto is_initializable_v = is_constructible_v<T, U> &&
static constexpr bool is_initializable_v = is_constructible_v<T, U> &&
std::is_convertible<U, T>::value &&
!is_status_or_v<U> &&
!is_status_v<U>;
Expand Down
3 changes: 2 additions & 1 deletion src/common/fs/FileUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ class FileUtils final {
#define CHECK_TYPE(NAME, FTYPE, DTYPE) \
bool FileUtils::is ## NAME(struct dirent *dEnt, const char* path) { \
if (dEnt->d_type == DT_UNKNOWN) { \
const char* subPath = FileUtils::joinPath(path, dEnt->d_name).c_str(); \
auto str = FileUtils::joinPath(path, dEnt->d_name); \
const char* subPath = str.c_str(); \
return FileUtils::fileType(subPath) == FileType::FTYPE; \
} else { \
return dEnt->d_type == DT_ ## DTYPE; \
Expand Down
3 changes: 2 additions & 1 deletion src/console/CmdProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void CmdProcessor::calColumnWidths(
}
case cpp2::ColumnValue::Type::double_precision: {
int digits10 = std::numeric_limits<double>::digits10;
const char *fmtValue = folly::sformat("%.{}lf", digits10).c_str();
auto str = folly::sformat("%.{}lf", digits10);
const char *fmtValue = str.c_str();
GET_VALUE_WIDTH(double, double_precision, fmtValue);
if (genFmt) {
std::string fmt = folly::sformat(" %%-%ld.{}lf |", digits10);
Expand Down

0 comments on commit b7582e2

Please sign in to comment.