From 501e1517825bae220b4145e082a6358cc6f9f34d Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 24 Jul 2024 12:16:12 +0800 Subject: 🔧 build(cmake parameter): set build warning as error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++++ src/stellar_on_sapp/stellar_on_sapp_api.c | 8 -------- test/plugin_manager/plugin_manager_gtest_main.cpp | 24 +++++++++++++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52f279c..261d071 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,10 @@ add_definitions(-D_GNU_SOURCE) set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_STANDARD 11) +#set warning as error +add_compile_options(-Wall -Wextra -Werror -Wno-error=unused-variable -Wno-error=unused-parameter) + + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) endif() diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c index 9a8991e..8b1f77f 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_api.c +++ b/src/stellar_on_sapp/stellar_on_sapp_api.c @@ -550,14 +550,6 @@ const char *session_get0_l2_l3_hdr(struct session *sess, int session_direction, } -static const void *session_get_cached_rawpkt(struct session *sess, int session_direction) -{ - struct streaminfo *pstream=sess->pstream; - assert(pstream); - int route_direction=(session_direction==SESSION_DIRECTION_IN)?(DIR_ROUTE_UP):(DIR_ROUTE_DOWN); - return get_rawpkt_from_streaminfo(pstream, route_direction); -} - uint16_t *session_get0_segment_id_list(struct session *sess, int session_direction, size_t *sid_num) { *sid_num=0; diff --git a/test/plugin_manager/plugin_manager_gtest_main.cpp b/test/plugin_manager/plugin_manager_gtest_main.cpp index 3282625..1f0fa26 100644 --- a/test/plugin_manager/plugin_manager_gtest_main.cpp +++ b/test/plugin_manager/plugin_manager_gtest_main.cpp @@ -1972,9 +1972,15 @@ static void test_session_mq_priority_plugin_1_on_msg(struct session *sess, int t } if(topic_id == env->test_mq_topic_id) { - if(ctx->called%3 == 2)EXPECT_EQ((int)(long)msg, env->plugin_id_2); - if(ctx->called%3 == 0)EXPECT_EQ((int )(long)msg, env->plugin_id_1); - } + if (ctx->called % 3 == 2) + { + EXPECT_EQ((int)(long)msg, env->plugin_id_2); + } + if (ctx->called % 3 == 0) + { + EXPECT_EQ((int)(long)msg, env->plugin_id_1); + } + } return; } @@ -1995,9 +2001,15 @@ static void test_session_mq_priority_plugin_2_on_msg(struct session *sess, int t } if(topic_id == env->test_mq_topic_id) { - if(ctx->called%3 == 2)EXPECT_EQ((int)(long)msg, env->plugin_id_2); - if(ctx->called%3 == 0)EXPECT_EQ((int)(long)msg, env->plugin_id_1); - } + if (ctx->called % 3 == 2) + { + EXPECT_EQ((int)(long)msg, env->plugin_id_2); + } + if (ctx->called % 3 == 0) + { + EXPECT_EQ((int)(long)msg, env->plugin_id_1); + } + } return; } -- cgit v1.2.3