diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index a2950ff05f..c0f4724b68 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -66,7 +66,10 @@ function(fory_configure_target target) target_compile_options(${target} PRIVATE /arch:AVX2) endif() else() - target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic) + target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic -Wno-unused-parameter) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(${target} PRIVATE -Wno-variadic-macro-arguments-omitted) + endif() if(FORY_WARNINGS_AS_ERRORS) target_compile_options(${target} PRIVATE -Werror) else() diff --git a/cpp/fory/meta/CMakeLists.txt b/cpp/fory/meta/CMakeLists.txt index d75c727d44..f63b98eebc 100644 --- a/cpp/fory/meta/CMakeLists.txt +++ b/cpp/fory/meta/CMakeLists.txt @@ -89,6 +89,6 @@ if(FORY_BUILD_TESTS) add_executable(fory_meta_field_test field_test.cc) fory_configure_target(fory_meta_field_test) - target_link_libraries(fory_meta_field_test fory_meta GTest::gtest) + target_link_libraries(fory_meta_field_test fory_meta GTest::gtest GTest::gtest_main) gtest_discover_tests(fory_meta_field_test) endif() diff --git a/cpp/fory/serialization/CMakeLists.txt b/cpp/fory/serialization/CMakeLists.txt index f07e612448..bfca6a8b1c 100644 --- a/cpp/fory/serialization/CMakeLists.txt +++ b/cpp/fory/serialization/CMakeLists.txt @@ -104,11 +104,6 @@ if(FORY_BUILD_TESTS) target_link_libraries(fory_serialization_variant_test fory_serialization GTest::gtest GTest::gtest_main) gtest_discover_tests(fory_serialization_variant_test) - add_executable(fory_serialization_field_test field_serializer_test.cc) - fory_configure_target(fory_serialization_field_test) - target_link_libraries(fory_serialization_field_test fory_serialization GTest::gtest) - gtest_discover_tests(fory_serialization_field_test) - add_executable(fory_serialization_namespace_macro_test namespace_macro_test.cc) fory_configure_target(fory_serialization_namespace_macro_test) target_link_libraries(fory_serialization_namespace_macro_test fory_serialization GTest::gtest GTest::gtest_main) diff --git a/cpp/fory/serialization/array_serializer.h b/cpp/fory/serialization/array_serializer.h index aef3851a49..b86976306d 100644 --- a/cpp/fory/serialization/array_serializer.h +++ b/cpp/fory/serialization/array_serializer.h @@ -114,7 +114,7 @@ struct Serializer< } static inline void write_data_generic(const std::array &arr, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(arr, ctx); } @@ -176,8 +176,7 @@ struct Serializer< } static inline std::array - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } }; @@ -232,7 +231,7 @@ template struct Serializer> { } static inline void write_data_generic(const std::array &arr, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(arr, ctx); } @@ -280,8 +279,7 @@ template struct Serializer> { } static inline std::array - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } }; @@ -310,7 +308,7 @@ template struct Serializer> { static inline void write(const std::array &arr, WriteContext &ctx, RefMode ref_mode, bool write_type, - bool has_generics = false) { + bool = false) { write_not_null_ref_flag(ctx, ref_mode); if (write_type) { ctx.write_uint8(static_cast(type_id)); @@ -341,7 +339,7 @@ template struct Serializer> { } static inline void write_data_generic(const std::array &arr, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(arr, ctx); } @@ -396,8 +394,7 @@ template struct Serializer> { } static inline std::array - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } }; @@ -423,7 +420,7 @@ template struct Serializer> { static inline void write(const std::array &arr, WriteContext &ctx, RefMode ref_mode, bool write_type, - bool has_generics = false) { + bool = false) { write_not_null_ref_flag(ctx, ref_mode); if (write_type) { ctx.write_uint8(static_cast(type_id)); @@ -454,7 +451,7 @@ template struct Serializer> { } static inline void write_data_generic(const std::array &arr, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(arr, ctx); } @@ -509,8 +506,7 @@ template struct Serializer> { } static inline std::array - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } }; diff --git a/cpp/fory/serialization/collection_serializer.h b/cpp/fory/serialization/collection_serializer.h index 06b63f5c60..4856b084b2 100644 --- a/cpp/fory/serialization/collection_serializer.h +++ b/cpp/fory/serialization/collection_serializer.h @@ -555,8 +555,7 @@ struct Serializer< } static inline void write(const std::vector &vec, WriteContext &ctx, - RefMode ref_mode, bool write_type, - bool has_generics = false) { + RefMode ref_mode, bool write_type, bool = false) { write_not_null_ref_flag(ctx, ref_mode); if (write_type) { ctx.write_uint8(static_cast(type_id)); @@ -586,7 +585,7 @@ struct Serializer< } static inline void write_data_generic(const std::vector &vec, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(vec, ctx); } @@ -612,8 +611,7 @@ struct Serializer< } static inline std::vector - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } @@ -671,7 +669,7 @@ template struct Serializer> { static inline void write(const std::vector &vec, WriteContext &ctx, RefMode ref_mode, bool write_type, - bool has_generics = false) { + bool = false) { write_not_null_ref_flag(ctx, ref_mode); if (write_type) { ctx.write_uint8(static_cast(type_id)); @@ -702,7 +700,7 @@ template struct Serializer> { static inline void write_data_generic(const std::vector &vec, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(vec, ctx); } @@ -727,8 +725,7 @@ template struct Serializer> { } static inline std::vector - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } @@ -777,7 +774,7 @@ template struct Serializer> { static inline void write(const std::vector &vec, WriteContext &ctx, RefMode ref_mode, bool write_type, - bool has_generics = false) { + bool = false) { write_not_null_ref_flag(ctx, ref_mode); if (write_type) { ctx.write_uint8(static_cast(type_id)); @@ -808,7 +805,7 @@ template struct Serializer> { static inline void write_data_generic(const std::vector &vec, - WriteContext &ctx, bool has_generics) { + WriteContext &ctx, bool) { write_data(vec, ctx); } @@ -833,8 +830,7 @@ template struct Serializer> { } static inline std::vector - read_with_type_info(ReadContext &ctx, RefMode ref_mode, - const TypeInfo &type_info) { + read_with_type_info(ReadContext &ctx, RefMode ref_mode, const TypeInfo &) { return read(ctx, ref_mode, false); } diff --git a/examples/cpp/hello_row/run.sh b/examples/cpp/hello_row/run.sh index 687470fcb3..3b09a0735e 100755 --- a/examples/cpp/hello_row/run.sh +++ b/examples/cpp/hello_row/run.sh @@ -22,7 +22,7 @@ set -e pip install cmake SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BUILD_DIR="${SCRIPT_DIR}/build" +BUILD_DIR="${SCRIPT_DIR}/cmake-build" echo "=== Fory C++ Hello Row Example Build Script ===" echo "" diff --git a/examples/cpp/hello_world/run.sh b/examples/cpp/hello_world/run.sh index c6929811db..407b21a801 100755 --- a/examples/cpp/hello_world/run.sh +++ b/examples/cpp/hello_world/run.sh @@ -22,7 +22,7 @@ set -e pip install cmake SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BUILD_DIR="${SCRIPT_DIR}/build" +BUILD_DIR="${SCRIPT_DIR}/cmake-build" echo "=== Fory C++ Hello World Example Build Script ===" echo ""