From 45c44093006f7a9fc608dd4de87d0978e07dfb01 Mon Sep 17 00:00:00 2001 From: Changyuan Ning <77976092+longfar-ncy@users.noreply.github.com> Date: Sat, 9 Mar 2024 18:37:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20return=20error=20status=20in=20GetListPe?= =?UTF-8?q?ers=20and=20add=20check=20for=20return-typ=E2=80=A6=20(#193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: return error status in GetListPeers and add check for return-type in cmake * ci: run actions when pull request to import-braft * Revert "ci: run actions when pull request to import-braft" This reverts commit 727c84d0b996e04332b0c0f16fbc57dd4028883b. --- CMakeLists.txt | 4 ++-- src/praft/praft.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 426847bb8..f5b81d952 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.14) PROJECT(PikiwiDB) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -g -D'GIT_COMMIT_ID=\"${GIT_COMMIT_ID}\"'") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -D'GIT_COMMIT_ID=\"${GIT_COMMIT_ID}\"'") # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: IF (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") @@ -73,7 +73,7 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Linux") set(CMAKE_THREAD_LIBS_INIT "-lpthread") ELSEIF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") - SET(CMAKE_CXX_FLAGS "-pthread -Wl,--no-as-needed -ldl -Wno-restrict") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wl,--no-as-needed -ldl") ENDIF () ADD_DEFINITIONS(-DOS_LINUX) ELSE () diff --git a/src/praft/praft.cc b/src/praft/praft.cc index 595fb3f08..4759466c9 100644 --- a/src/praft/praft.cc +++ b/src/praft/praft.cc @@ -156,9 +156,9 @@ braft::NodeStatus PRaft::GetNodeStatus() const { butil::Status PRaft::GetListPeers(std::vector* peers) { if (!node_) { LOG(ERROR) << "Node is not initialized"; - } else { - return node_->list_peers(peers); + return {EINVAL, "Node is not initialized"}; } + return node_->list_peers(peers); } // Gets the cluster id, which is used to initialize node