This is an automated email from the ASF dual-hosted git repository.

xiaokang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git


The following commit(s) were added to refs/heads/main by this push:
     new 31b78b0f feat(cmake): Enable (-Wall -Werror -Wextra) compilation flag 
to detect potential bugs early  (#863)
31b78b0f is described below

commit 31b78b0fe70b9abcab974c9fe62aeb92222f7482
Author: Jason <[email protected]>
AuthorDate: Wed Feb 25 13:57:26 2026 +0800

    feat(cmake): Enable (-Wall -Werror -Wextra) compilation flag to detect 
potential bugs early  (#863)
    
    * feat(cmake): enable (-Wall -Werror -Wextra) compilation flag to detect 
potential bugs early
    
    * fix: comparison of integer expressions of different signedness
    
    * Update cpp/CMakeLists.txt
    
    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Jason <[email protected]>
    
    * Update cpp/CMakeLists.txt
    
    Co-authored-by: Copilot <[email protected]>
    Signed-off-by: Jason <[email protected]>
    
    ---------
    
    Signed-off-by: Jason <[email protected]>
    Co-authored-by: Copilot <[email protected]>
---
 cpp/CMakeLists.txt                       | 32 ++++++++++++++++++++++-----
 cpp/examples/mid_level_reader_example.cc |  6 +++--
 cpp/src/graphar/arrow/chunk_reader.cc    | 38 ++++++++++++++++++++++++++++++++
 cpp/src/graphar/arrow/chunk_reader.h     | 11 +++++++++
 cpp/src/graphar/status.h                 |  3 +--
 rust/build.rs                            |  1 +
 6 files changed, 81 insertions(+), 10 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 549dd9b8..14c89c34 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -110,7 +110,7 @@ if(MSVC)
     # Avoid GCC/Clang-specific flags on MSVC.
     # C++17 is already enforced via CMAKE_CXX_STANDARD/target features.
 else()
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=unused-variable")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra 
-Wno-unused-parameter -Wno-empty-body")
 endif()
 
 if (APPLE)
@@ -191,7 +191,7 @@ endmacro()
 
 macro(install_graphar_target target)
   # install
-  install(TARGETS ${target}
+  install(TARGETS ${target} graphar_thirdparty
           EXPORT graphar-targets
           ARCHIVE DESTINATION lib
           LIBRARY DESTINATION lib
@@ -288,8 +288,19 @@ function(graphar_create_merged_static_lib output_target)
   add_dependencies(${output_target} ${output_target}_merge)
 endfunction()
 
+macro(build_graphar_thirdparty)
+    file(GLOB_RECURSE THIRDPARTY_SRC_FILES 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mini-yaml/yaml/*.cpp)
+    add_library(graphar_thirdparty STATIC ${THIRDPARTY_SRC_FILES})
+    target_include_directories(graphar_thirdparty PRIVATE 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
+    target_compile_features(graphar_thirdparty PRIVATE cxx_std_17)
+    if(NOT MSVC)
+        target_compile_options(graphar_thirdparty PRIVATE -fPIC -w)
+    endif()
+endmacro()
+
 macro(build_graphar)
-    file(GLOB_RECURSE CORE_SRC_FILES "src/graphar/*.cc" 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mini-yaml/yaml/*.cpp)
+    build_graphar_thirdparty()
+    file(GLOB_RECURSE CORE_SRC_FILES "src/graphar/*.cc")
     if(GRAPHAR_BUILD_STATIC)
         add_library(graphar STATIC ${CORE_SRC_FILES})
     else()
@@ -298,7 +309,11 @@ macro(build_graphar)
     install_graphar_target(graphar)
     target_compile_features(graphar PRIVATE cxx_std_${GAR_CXX_STANDARD})
     target_include_directories(graphar PRIVATE 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
-    target_link_libraries(graphar PRIVATE ${CMAKE_DL_LIBS})
+    if(GRAPHAR_BUILD_STATIC)
+        target_link_libraries(graphar PUBLIC graphar_thirdparty 
${CMAKE_DL_LIBS})
+    else()
+        target_link_libraries(graphar PRIVATE graphar_thirdparty 
${CMAKE_DL_LIBS})
+    endif()
 
     if(APPLE)
         if(USE_STATIC_ARROW)
@@ -346,7 +361,8 @@ macro(build_graphar)
 endmacro()
 
 macro(build_graphar_with_arrow_bundled)
-    file(GLOB_RECURSE CORE_SRC_FILES "src/graphar/*.cc" 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/mini-yaml/yaml/*.cpp)
+    build_graphar_thirdparty()
+    file(GLOB_RECURSE CORE_SRC_FILES "src/graphar/*.cc")
     if(GRAPHAR_BUILD_STATIC)
         add_library(graphar STATIC ${CORE_SRC_FILES})
     else()
@@ -356,7 +372,11 @@ macro(build_graphar_with_arrow_bundled)
     target_compile_features(graphar PRIVATE cxx_std_${GAR_CXX_STANDARD})
     target_include_directories(graphar PRIVATE 
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
     target_include_directories(graphar SYSTEM BEFORE PRIVATE 
${GAR_ARROW_INCLUDE_DIR})
-    target_link_libraries(graphar PRIVATE ${CMAKE_DL_LIBS})
+    if(GRAPHAR_BUILD_STATIC)
+        target_link_libraries(graphar PUBLIC graphar_thirdparty 
${CMAKE_DL_LIBS})
+    else()
+        target_link_libraries(graphar PRIVATE graphar_thirdparty 
${CMAKE_DL_LIBS})
+    endif()
 
     set(GAR_BUNDLED_DEPS_STATIC_LIBS)
     list(APPEND GAR_BUNDLED_DEPS_STATIC_LIBS
diff --git a/cpp/examples/mid_level_reader_example.cc 
b/cpp/examples/mid_level_reader_example.cc
index 1299afd8..ead6a8f9 100644
--- a/cpp/examples/mid_level_reader_example.cc
+++ b/cpp/examples/mid_level_reader_example.cc
@@ -131,7 +131,8 @@ void vertex_property_chunk_reader(
   specific_table = specific_result.value();
   std::cout << "rows number of specified vertex properties chunk: "
             << specific_table->num_rows() << std::endl;
-  ASSERT(specific_table->num_columns() == specific_cols.size() + 1);
+  ASSERT(specific_table->num_columns() ==
+         static_cast<int>(specific_cols.size()) + 1);
   std::cout << "schema of specified vertex properties chunk: " << std::endl
             << specific_table->schema()->ToString() << std::endl;
   index_col =
@@ -159,7 +160,8 @@ void vertex_property_chunk_reader(
   specific_table = specific_result.value();
   std::cout << "rows number of specified vertex properties chunk (V2): "
             << specific_table->num_rows() << std::endl;
-  ASSERT(specific_table->num_columns() == specific_cols.size() + 1);
+  ASSERT(specific_table->num_columns() ==
+         static_cast<int>(specific_cols.size()) + 1);
   std::cout << "schema of specified vertex properties chunk (V2): " << 
std::endl
             << specific_table->schema()->ToString() << std::endl;
   index_col =
diff --git a/cpp/src/graphar/arrow/chunk_reader.cc 
b/cpp/src/graphar/arrow/chunk_reader.cc
index f47d1374..030d595d 100644
--- a/cpp/src/graphar/arrow/chunk_reader.cc
+++ b/cpp/src/graphar/arrow/chunk_reader.cc
@@ -549,6 +549,23 @@ AdjListArrowChunkReader::AdjListArrowChunkReader(
       base_dir_(other.base_dir_),
       fs_(other.fs_) {}
 
+AdjListArrowChunkReader& AdjListArrowChunkReader::operator=(
+    const AdjListArrowChunkReader& other) {
+  if (this != &other) {
+    edge_info_ = other.edge_info_;
+    adj_list_type_ = other.adj_list_type_;
+    vertex_chunk_index_ = other.vertex_chunk_index_;
+    chunk_index_ = other.chunk_index_;
+    seek_offset_ = other.seek_offset_;
+    chunk_table_ = nullptr;
+    vertex_chunk_num_ = other.vertex_chunk_num_;
+    chunk_num_ = other.chunk_num_;
+    base_dir_ = other.base_dir_;
+    fs_ = other.fs_;
+  }
+  return *this;
+}
+
 Status AdjListArrowChunkReader::seek_src(IdType id) {
   if (adj_list_type_ != AdjListType::unordered_by_source &&
       adj_list_type_ != AdjListType::ordered_by_source) {
@@ -879,6 +896,27 @@ 
AdjListPropertyArrowChunkReader::AdjListPropertyArrowChunkReader(
       base_dir_(other.base_dir_),
       fs_(other.fs_) {}
 
+AdjListPropertyArrowChunkReader& AdjListPropertyArrowChunkReader::operator=(
+    const AdjListPropertyArrowChunkReader& other) {
+  if (this != &other) {
+    edge_info_ = other.edge_info_;
+    property_group_ = other.property_group_;
+    adj_list_type_ = other.adj_list_type_;
+    prefix_ = other.prefix_;
+    vertex_chunk_index_ = other.vertex_chunk_index_;
+    chunk_index_ = other.chunk_index_;
+    seek_offset_ = other.seek_offset_;
+    schema_ = other.schema_;
+    chunk_table_ = nullptr;
+    filter_options_ = other.filter_options_;
+    vertex_chunk_num_ = other.vertex_chunk_num_;
+    chunk_num_ = other.chunk_num_;
+    base_dir_ = other.base_dir_;
+    fs_ = other.fs_;
+  }
+  return *this;
+}
+
 Status AdjListPropertyArrowChunkReader::seek_src(IdType id) {
   if (adj_list_type_ != AdjListType::unordered_by_source &&
       adj_list_type_ != AdjListType::ordered_by_source) {
diff --git a/cpp/src/graphar/arrow/chunk_reader.h 
b/cpp/src/graphar/arrow/chunk_reader.h
index de2cf41f..779f8596 100644
--- a/cpp/src/graphar/arrow/chunk_reader.h
+++ b/cpp/src/graphar/arrow/chunk_reader.h
@@ -292,6 +292,11 @@ class AdjListArrowChunkReader {
    */
   AdjListArrowChunkReader(const AdjListArrowChunkReader& other);
 
+  /**
+   * @brief Copy assignment operator.
+   */
+  AdjListArrowChunkReader& operator=(const AdjListArrowChunkReader& other);
+
   /**
    * @brief Sets chunk position indicator for reader by source vertex id.
    *
@@ -494,6 +499,12 @@ class AdjListPropertyArrowChunkReader {
    */
   AdjListPropertyArrowChunkReader(const AdjListPropertyArrowChunkReader& 
other);
 
+  /**
+   * @brief Copy assignment operator.
+   */
+  AdjListPropertyArrowChunkReader& operator=(
+      const AdjListPropertyArrowChunkReader& other);
+
   /**
    * @brief Sets chunk position indicator for reader by source vertex id.
    *
diff --git a/cpp/src/graphar/status.h b/cpp/src/graphar/status.h
index 941ef22f..ae89fde8 100644
--- a/cpp/src/graphar/status.h
+++ b/cpp/src/graphar/status.h
@@ -164,8 +164,7 @@ class Status {
 
   template <typename... Args>
   static Status FromArgs(StatusCode code, Args... args) {
-    return Status(code,
-                  std::move(util::StringBuilder(std::forward<Args>(args)...)));
+    return Status(code, util::StringBuilder(std::forward<Args>(args)...));
   }
 
   /** Returns an error status when some IO-related operation failed. */
diff --git a/rust/build.rs b/rust/build.rs
index 4f3f45e0..55e90636 100644
--- a/rust/build.rs
+++ b/rust/build.rs
@@ -30,6 +30,7 @@ fn link_libraries() {
         .expect("Arrow development files not found via pkg-config. Set 
PKG_CONFIG_PATH if needed.");
 
     println!("cargo:rustc-link-lib=graphar");
+    println!("cargo:rustc-link-lib=graphar_thirdparty");
 }
 
 fn build_ffi(bridge_file: &str, out_name: &str, source_file: &str, 
include_paths: &[PathBuf]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to