diff options
author | Benoît Ganne <bganne@cisco.com> | 2019-04-30 11:50:46 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-06-07 11:21:59 +0000 |
commit | 49ee68443d41ffe1ab72c964104da980a2eb4367 (patch) | |
tree | f87d2096fbd19c629390548c7b1d6351e3479851 | |
parent | 4168c4d914c36f76c45cd8c6dde207b9f1c688e2 (diff) |
build: add -Wall and -fno-common, fix reported issues
Type: refactor
Change-Id: I8489ccd54411c2aa9355439c5641dc31012c64a2
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Signed-off-by: Damjan Marion <damarion@cisco.com>
37 files changed, 107 insertions, 143 deletions
diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk index 97484802581..11ffdacaf52 100644 --- a/build-data/platforms/vpp.mk +++ b/build-data/platforms/vpp.mk @@ -22,20 +22,26 @@ endif vpp_root_packages = vpp vom -vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 \ - -fstack-protector-all -fPIC -Werror -vpp_debug_TAG_CXXFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 \ - -fstack-protector-all -fPIC -Werror -vpp_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 \ - -fstack-protector-all -fPIC -Werror - -vpp_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -vpp_TAG_CXXFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -vpp_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -pie - -vpp_clang_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -vpp_clang_TAG_CXXFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -vpp_clang_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror +vpp_common_cflags = \ + -g \ + -DFORTIFY_SOURCE=2 \ + -fstack-protector \ + -fPIC \ + -Wall \ + -Werror \ + -fno-common + +vpp_debug_TAG_CFLAGS = -O0 -DCLIB_DEBUG $(vpp_common_cflags) +vpp_debug_TAG_CXXFLAGS = -O0 -DCLIB_DEBUG $(vpp_common_cflags) +vpp_debug_TAG_LDFLAGS = -O0 -DCLIB_DEBUG $(vpp_common_cflags) + +vpp_TAG_CFLAGS = -O2 $(vpp_common_cflags) +vpp_TAG_CXXFLAGS = -O2 $(vpp_common_cflags) +vpp_TAG_LDFLAGS = -O2 $(vpp_common_cflags) -pie + +vpp_clang_TAG_CFLAGS = -O2 $(vpp_common_cflags) +vpp_clang_TAG_CXXFLAGS = -O2 $(vpp_common_cflags) +vpp_clang_TAG_LDFLAGS = -O2 $(vpp_common_cflags) vpp_gcov_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DCLIB_GCOV -fPIC -Werror -fprofile-arcs -ftest-coverage vpp_gcov_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DCLIB_GCOV -fPIC -Werror -coverage diff --git a/extras/libmemif/examples/icmp_responder-eb/main.c b/extras/libmemif/examples/icmp_responder-eb/main.c index 9e71d283c2c..646a6ca0511 100644 --- a/extras/libmemif/examples/icmp_responder-eb/main.c +++ b/extras/libmemif/examples/icmp_responder-eb/main.c @@ -462,6 +462,9 @@ icmpr_add_external_region (void * *addr, uint32_t size, int *fd, err = ftruncate (rfd, size); + if (err) + return err; + raddr = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, rfd, 0); *addr = raddr; @@ -500,7 +503,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; uint16_t rx = 0, tx = 0; - uint16_t fb = 0; int i = 0; int j = 0; @@ -579,8 +581,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; int i; uint16_t rx, tx; - uint16_t fb; - uint16_t pck_seq; do { @@ -657,7 +657,6 @@ icmpr_memif_create (long index, long mode, char *s) memif_connection_t *c = &memif_connection[index]; memif_conn_args_t args; - int fd = -1; memset (&args, 0, sizeof (args)); args.is_master = mode; args.log2_ring_size = 11; @@ -830,8 +829,6 @@ icmpr_send (long index, long packet_num, char *hw, char *ip) memif_connection_t *c = &memif_connection[index]; if (c->conn == NULL) return -1; - int err, i; - uint16_t tx = 0, rx = 0; char *end, *ui; uint8_t tmp[6]; icmpr_thread_data_t *data = &icmpr_thread_data[index]; @@ -977,9 +974,8 @@ done: int poll_event (int timeout) { - struct epoll_event evt, *e; + struct epoll_event evt; int app_err = 0, memif_err = 0, en = 0; - int tmp, nfd; uint32_t events = 0; memset (&evt, 0, sizeof (evt)); evt.events = EPOLLIN | EPOLLOUT; diff --git a/extras/libmemif/examples/icmp_responder-epoll/main.c b/extras/libmemif/examples/icmp_responder-epoll/main.c index 02414fa25be..ecc05a41e77 100644 --- a/extras/libmemif/examples/icmp_responder-epoll/main.c +++ b/extras/libmemif/examples/icmp_responder-epoll/main.c @@ -372,7 +372,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; uint16_t rx = 0, tx = 0; - uint16_t fb = 0; int i = 0; /* rx buffer iterator */ int j = 0; /* tx bufferiterator */ @@ -457,10 +456,8 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; uint16_t rx = 0, tx = 0; - uint16_t fb; int i; /* rx buffer iterator */ int j; /* tx bufferiterator */ - int prev_i; /* first allocated rx buffer */ /* loop while there are packets in shm */ do @@ -475,7 +472,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) goto error; } - prev_i = i = 0; + i = 0; /* loop while there are RX buffers to be processed */ while (rx) @@ -522,7 +519,6 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) if (err != MEMIF_ERR_SUCCESS) INFO ("memif_buffer_free: %s", memif_strerror (err)); rx -= j; - prev_i = i; DBG ("freed %d buffers. %u/%u alloc/free buffers", fb, rx, MAX_MEMIF_BUFS - rx); @@ -570,8 +566,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; int i; uint16_t rx, tx; - uint16_t fb; - uint16_t pck_seq; do { @@ -639,7 +633,6 @@ icmpr_memif_create (long index, long mode, char *s) /* setting memif connection arguments */ memif_conn_args_t args; - int fd = -1; memset (&args, 0, sizeof (args)); args.is_master = mode; args.log2_ring_size = 11; @@ -1106,7 +1099,6 @@ error: int user_input_handler () { - int i; char *in = (char *) malloc (256); char *ui = fgets (in, 256, stdin); char *end; @@ -1223,9 +1215,8 @@ done: int poll_event (int timeout) { - struct epoll_event evt, *e; + struct epoll_event evt; int app_err = 0, memif_err = 0, en = 0; - int tmp, nfd; uint32_t events = 0; struct timespec start, end; memset (&evt, 0, sizeof (evt)); diff --git a/extras/libmemif/examples/icmp_responder-mt/main.c b/extras/libmemif/examples/icmp_responder-mt/main.c index 8fa64cf93af..bc2f71dd328 100644 --- a/extras/libmemif/examples/icmp_responder-mt/main.c +++ b/extras/libmemif/examples/icmp_responder-mt/main.c @@ -112,7 +112,6 @@ pthread_t thread[MAX_THREADS]; void user_signal_handler (int sig) { - sig = sig; } static void @@ -375,9 +374,8 @@ memif_rx_interrupt (void *ptr) memif_connection_t *c = &memif_connection[data->index]; int err; uint16_t rx = 0, tx = 0, fb = 0; - struct epoll_event evt, *e; + struct epoll_event evt; int en = 0; - uint32_t events = 0; sigset_t sigset; signal (SIGUSR1, user_signal_handler); @@ -602,7 +600,6 @@ icmpr_memif_create (long index) /* setting memif connection arguments */ memif_conn_args_t args; - int fd = -1; memset (&args, 0, sizeof (args)); args.is_master = 0; args.log2_ring_size = 10; @@ -765,7 +762,6 @@ error: int user_input_handler () { - int i; char *in = (char *) malloc (256); char *ui = fgets (in, 256, stdin); char *end; @@ -830,9 +826,8 @@ done: int poll_event (int timeout) { - struct epoll_event evt, *e; + struct epoll_event evt; int app_err = 0, memif_err = 0, en = 0; - int tmp, nfd; uint32_t events = 0; memset (&evt, 0, sizeof (evt)); evt.events = EPOLLIN | EPOLLOUT; diff --git a/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c b/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c index aad33039bd8..7913588299a 100644 --- a/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c +++ b/extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c @@ -330,9 +330,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; uint16_t rx = 0, tx = 0; - uint16_t fb = 0; int i = 0; /* rx buffer iterator */ - int j = 0; /* tx bufferiterator */ /* loop while there are packets in shm */ do @@ -413,9 +411,7 @@ on_interrupt0 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; uint16_t rx = 0, tx = 0; - uint16_t fb = 0; int i = 0; /* rx buffer iterator */ - int j = 0; /* tx bufferiterator */ /* loop while there are packets in shm */ do @@ -497,8 +493,6 @@ on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) int err = MEMIF_ERR_SUCCESS, ret_val; int i; uint16_t rx, tx; - uint16_t fb; - uint16_t pck_seq; do { @@ -565,7 +559,6 @@ icmpr_memif_create (long index, long mode, char *s) /* setting memif connection arguments */ memif_conn_args_t args; - int fd = -1; memset (&args, 0, sizeof (args)); args.is_master = mode; args.log2_ring_size = 11; @@ -1051,7 +1044,6 @@ error: int user_input_handler () { - int i; char *in = (char *) malloc (256); char *ui = fgets (in, 256, stdin); char *end; @@ -1167,9 +1159,8 @@ done: int poll_event (int timeout) { - struct epoll_event evt, *e; + struct epoll_event evt; int app_err = 0, memif_err = 0, en = 0; - int tmp, nfd; uint32_t events = 0; struct timespec start, end; memset (&evt, 0, sizeof (evt)); diff --git a/extras/libmemif/examples/icmp_responder/icmp_proto.c b/extras/libmemif/examples/icmp_responder/icmp_proto.c index e1d255aca27..785aebd5567 100644 --- a/extras/libmemif/examples/icmp_responder/icmp_proto.c +++ b/extras/libmemif/examples/icmp_responder/icmp_proto.c @@ -458,7 +458,6 @@ int resolve_packet3 (void **pck_, uint32_t * size, uint8_t ip_addr[4]) { struct ether_header *eh; - struct ether_arp *eah; struct iphdr *ip; struct icmphdr *icmp; int32_t offset = 0; diff --git a/extras/libmemif/examples/icmp_responder/main.c b/extras/libmemif/examples/icmp_responder/main.c index fa7bcb9a636..2e85d0320d5 100644 --- a/extras/libmemif/examples/icmp_responder/main.c +++ b/extras/libmemif/examples/icmp_responder/main.c @@ -290,6 +290,7 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) memif_connection_t *c = &memif_connection; int err; uint16_t rx; + uint16_t fb = 0; /* receive data from shared memory buffers */ err = memif_rx_burst (c->conn, qid, c->rx_bufs, MAX_MEMIF_BUFS, &rx); c->rx_buf_num += rx; @@ -311,7 +312,6 @@ on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid) &(c->tx_bufs + i)->len, c->ip_addr); } - uint16_t fb; /* mark memif buffers and shared memory buffers as free */ err = memif_refill_queue (c->conn, qid, rx, 0); c->rx_buf_num -= fb; @@ -338,7 +338,6 @@ icmpr_memif_create (int is_master) { /* setting memif connection arguments */ memif_conn_args_t args; - int fd = -1; memset (&args, 0, sizeof (args)); args.is_master = is_master; args.log2_ring_size = 10; diff --git a/extras/libmemif/test/main_test.c b/extras/libmemif/test/main_test.c index e4697beb56f..6c29babcb2e 100644 --- a/extras/libmemif/test/main_test.c +++ b/extras/libmemif/test/main_test.c @@ -173,8 +173,6 @@ START_TEST (test_create_master) memset (&args, 0, sizeof (args)); args.is_master = 1; - libmemif_main_t *lm = &libmemif_main; - if ((err = memif_init (control_fd_update, TEST_APP_NAME, NULL, NULL, NULL)) != MEMIF_ERR_SUCCESS) @@ -584,7 +582,7 @@ END_TEST START_TEST (test_rx_burst) { int err, i; - uint16_t max_buf = 10, buf, rx; + uint16_t max_buf = 10, rx; uint8_t qid; memif_buffer_t *bufs; memif_queue_t *mq; diff --git a/extras/libmemif/test/unit_test.c b/extras/libmemif/test/unit_test.c index a305de93fbe..9c9a8d4de66 100644 --- a/extras/libmemif/test/unit_test.c +++ b/extras/libmemif/test/unit_test.c @@ -46,13 +46,13 @@ int main (void) { int num_fail; - Suite *main, *socket; + Suite *mains, *socket; SRunner *sr; - main = main_suite (); + mains = main_suite (); socket = socket_suite (); - sr = srunner_create (main); + sr = srunner_create (mains); srunner_add_suite (sr, socket); diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake index df52053bab5..e586ecc523c 100644 --- a/src/cmake/cpu.cmake +++ b/src/cmake/cpu.cmake @@ -95,7 +95,7 @@ macro(vpp_library_set_multiarch_sources lib) set(l ${lib}_${VARIANT}) add_library(${l} OBJECT ${ARGN}) set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON) - target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}" -Wall -fno-common) + target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}") separate_arguments(VARIANT_FLAGS) target_compile_options(${l} PUBLIC ${VARIANT_FLAGS}) target_sources(${lib} PRIVATE $<TARGET_OBJECTS:${l}>) diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake index 747aeb4705f..18ab8ed55f3 100644 --- a/src/cmake/library.cmake +++ b/src/cmake/library.cmake @@ -20,7 +20,6 @@ macro(add_vpp_library lib) ) add_library(${lib} SHARED ${ARG_SOURCES}) - target_compile_options(${lib} PRIVATE -Wall -fno-common) if(VPP_LIB_VERSION) set_target_properties(${lib} PROPERTIES SOVERSION ${VPP_LIB_VERSION}) endif() diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake index 1565170dedf..b18f337f218 100644 --- a/src/cmake/plugin.cmake +++ b/src/cmake/plugin.cmake @@ -45,7 +45,6 @@ macro(add_vpp_plugin name) endforeach() add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_includes}) set_target_properties(${plugin_name} PROPERTIES NO_SONAME 1) - target_compile_options(${plugin_name} PRIVATE -Wall) if(NOT VPP_EXTERNAL_PROJECT) add_dependencies(${plugin_name} vpp_version_h api_headers) endif() diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c index c130b908934..45de3a76be6 100644 --- a/src/plugins/flowprobe/flowprobe.c +++ b/src/plugins/flowprobe/flowprobe.c @@ -51,7 +51,6 @@ #undef vl_printfun flowprobe_main_t flowprobe_main; -vlib_node_registration_t flowprobe_walker_node; static vlib_node_registration_t flowprobe_timer_node; uword flowprobe_walker_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f); diff --git a/src/plugins/flowprobe/flowprobe.h b/src/plugins/flowprobe/flowprobe.h index 92c3f9063a3..2d28c81de33 100644 --- a/src/plugins/flowprobe/flowprobe.h +++ b/src/plugins/flowprobe/flowprobe.h @@ -157,6 +157,7 @@ typedef struct } flowprobe_main_t; extern flowprobe_main_t flowprobe_main; +extern vlib_node_registration_t flowprobe_walker_node; void flowprobe_flush_callback_ip4 (void); void flowprobe_flush_callback_ip6 (void); diff --git a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c index 85e1ee37bcc..ff3f36783fc 100644 --- a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c +++ b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c @@ -59,7 +59,7 @@ typedef struct vat_main_t *vat_main; } export_test_main_t; -export_test_main_t export_test_main; +static export_test_main_t export_test_main; #define foreach_standard_reply_retval_handler \ _(vxlan_gpe_ioam_export_enable_disable_reply) diff --git a/src/plugins/ioam/export/ioam_export_test.c b/src/plugins/ioam/export/ioam_export_test.c index 2af4eeed51a..cd98877ac22 100644 --- a/src/plugins/ioam/export/ioam_export_test.c +++ b/src/plugins/ioam/export/ioam_export_test.c @@ -60,7 +60,7 @@ typedef struct vat_main_t *vat_main; } export_test_main_t; -export_test_main_t export_test_main; +static export_test_main_t export_test_main; #define foreach_standard_reply_retval_handler \ _(ioam_export_ip6_enable_disable_reply) diff --git a/src/plugins/lacp/node.h b/src/plugins/lacp/node.h index 88bc5872390..8bc7cf9329c 100644 --- a/src/plugins/lacp/node.h +++ b/src/plugins/lacp/node.h @@ -37,7 +37,7 @@ typedef enum MARKER_N_PACKET_TEMPLATES, } marker_packet_template_id_t; -enum +typedef enum { LACP_PROCESS_EVENT_START = 1, LACP_PROCESS_EVENT_STOP = 2, diff --git a/src/plugins/lb/lb_test.c b/src/plugins/lb/lb_test.c index cf55aec614f..00ad673d354 100644 --- a/src/plugins/lb/lb_test.c +++ b/src/plugins/lb/lb_test.c @@ -177,13 +177,14 @@ static int api_lb_add_del_vip (vat_main_t * vam) int ret; ip46_address_t ip_prefix; u8 prefix_length = 0; - u8 protocol; + u8 protocol = 0; u32 port = 0; u32 encap = 0; u32 dscp = ~0; u32 srv_type = LB_SRV_TYPE_CLUSTERIP; u32 target_port = 0; u32 new_length = 1024; + int is_del = 0; if (!unformat(line_input, "%U", unformat_ip46_prefix, &ip_prefix, &prefix_length, IP46_TYPE_ANY, &prefix_length)) { @@ -196,7 +197,7 @@ static int api_lb_add_del_vip (vat_main_t * vam) if (unformat(line_input, "new_len %d", &new_length)) ; else if (unformat(line_input, "del")) - mp->is_del = 1; + is_del = 1; else if (unformat(line_input, "protocol tcp")) { protocol = IP_PROTOCOL_TCP; @@ -254,6 +255,7 @@ static int api_lb_add_del_vip (vat_main_t * vam) mp->target_port = htons((u16)target_port); mp->node_port = htons((u16)target_port); mp->new_flows_table_length = htonl(new_length); + mp->is_del = is_del; S(mp); W (ret); @@ -269,7 +271,6 @@ static int api_lb_add_del_as (vat_main_t * vam) ip46_address_t vip_prefix, as_addr; u8 vip_plen; ip46_address_t *as_array = 0; - u32 vip_index; u32 port = 0; u8 protocol = 0; u8 is_del = 0; diff --git a/src/plugins/nsim/nsim_test.c b/src/plugins/nsim/nsim_test.c index 35f222eadf0..e3c95c7c204 100644 --- a/src/plugins/nsim/nsim_test.c +++ b/src/plugins/nsim/nsim_test.c @@ -226,7 +226,6 @@ api_nsim_configure (vat_main_t * vam) unformat_input_t *i = vam->input; f64 delay = 0.0, bandwidth = 0.0; f64 packet_size = 1500.0; - u32 num_workers = vlib_num_workers (); u32 packets_per_drop = 0; int ret; diff --git a/src/plugins/srv6-ad/ad.c b/src/plugins/srv6-ad/ad.c index 9cf9eb1f945..73ea3f6ac1f 100644 --- a/src/plugins/srv6-ad/ad.c +++ b/src/plugins/srv6-ad/ad.c @@ -35,6 +35,7 @@ unsigned char def_str[] = "Endpoint with dynamic proxy to SR-unaware appliance"; unsigned char params_str[] = "nh <next-hop> oif <iface-out> iif <iface-in>"; +srv6_ad_main_t srv6_ad_main; /*****************************************/ /* SRv6 LocalSID instantiation and removal functions */ diff --git a/src/plugins/srv6-ad/ad.h b/src/plugins/srv6-ad/ad.h index ff00f84aac1..e519cfb6b6c 100644 --- a/src/plugins/srv6-ad/ad.h +++ b/src/plugins/srv6-ad/ad.h @@ -66,7 +66,7 @@ typedef struct vlib_combined_counter_main_t invalid_counters;/**< Invalid rewrite counters */ } srv6_ad_main_t; -srv6_ad_main_t srv6_ad_main; +extern srv6_ad_main_t srv6_ad_main; format_function_t format_srv6_ad_localsid; unformat_function_t unformat_srv6_ad_localsid; diff --git a/src/plugins/srv6-am/am.c b/src/plugins/srv6-am/am.c index 9e3f2a32eb8..2507a75dce8 100644 --- a/src/plugins/srv6-am/am.c +++ b/src/plugins/srv6-am/am.c @@ -29,6 +29,7 @@ unsigned char keyword_str[] = "End.AM"; unsigned char def_str[] = "Endpoint to SR-unaware appliance via masquerading"; unsigned char params_str[] = "nh <next-hop> oif <iface-out> iif <iface-in>"; +srv6_am_main_t srv6_am_main; /*****************************************/ /* SRv6 LocalSID instantiation and removal functions */ diff --git a/src/plugins/srv6-am/am.h b/src/plugins/srv6-am/am.h index f9c8ba4479a..5d98a7ee8ac 100644 --- a/src/plugins/srv6-am/am.h +++ b/src/plugins/srv6-am/am.h @@ -46,7 +46,7 @@ typedef struct u32 sw_if_index_in; /**< Incoming iface from proxied device */ } srv6_am_localsid_t; -srv6_am_main_t srv6_am_main; +extern srv6_am_main_t srv6_am_main; format_function_t format_srv6_am_localsid; unformat_function_t unformat_srv6_am_localsid; diff --git a/src/plugins/srv6-as/as.c b/src/plugins/srv6-as/as.c index 7a982dedda8..8cd964b60f2 100644 --- a/src/plugins/srv6-as/as.c +++ b/src/plugins/srv6-as/as.c @@ -36,6 +36,7 @@ unsigned char def_str[] = unsigned char params_str[] = "nh <next-hop> oif <iface-out> iif <iface-in> src <src-addr> next <sid> [next <sid> ...]"; +srv6_as_main_t srv6_as_main; static inline u8 * prepare_rewrite (ip6_address_t src_addr, ip6_address_t * sid_list, diff --git a/src/plugins/srv6-as/as.h b/src/plugins/srv6-as/as.h index 0eed05d3156..752d2529f56 100644 --- a/src/plugins/srv6-as/as.h +++ b/src/plugins/srv6-as/as.h @@ -68,7 +68,7 @@ typedef struct vlib_combined_counter_main_t invalid_counters;/**< Invalid rewrite counters */ } srv6_as_main_t; -srv6_as_main_t srv6_as_main; +extern srv6_as_main_t srv6_as_main; format_function_t format_srv6_as_localsid; unformat_function_t unformat_srv6_as_localsid; diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c index 3a70d3964c6..c9992befe98 100644 --- a/src/tests/vnet/session/udp_echo.c +++ b/src/tests/vnet/session/udp_echo.c @@ -419,7 +419,7 @@ wait_for_state_change (udp_echo_main_t * utm, connection_state_t state) u64 server_bytes_received, server_bytes_sent; -static void * +__clib_unused static void * cut_through_thread_fn (void *arg) { app_session_t *s; @@ -716,7 +716,7 @@ send_test_chunk (udp_echo_main_t * utm, app_session_t * s, u32 bytes) u64 test_buf_len, bytes_this_chunk, test_buf_offset; u8 *test_data = utm->connect_test_data; - u32 bytes_to_snd, enq_space, min_chunk; + u32 enq_space; int written; test_buf_len = vec_len (test_data); @@ -807,7 +807,6 @@ static void client_test (udp_echo_main_t * utm) { f64 start_time, timeout = 100.0; - app_session_t *session; svm_msg_q_msg_t msg; session_event_t *e; @@ -1028,7 +1027,6 @@ server_handle_event_queue (udp_echo_main_t * utm) session_event_t *e; svm_msg_q_msg_t msg; svm_msg_q_t *mq = utm->our_event_queue; - int i; while (utm->state != STATE_READY) sleep (5); diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 5836e3c307d..be074bec615 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -398,7 +398,7 @@ format_ipsec_integ_alg (u8 * s, va_list * args) static uword api_unformat_sw_if_index (unformat_input_t * input, va_list * args) { - vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *); + vat_main_t *vam __clib_unused = va_arg (*args, vat_main_t *); vnet_main_t *vnm = vnet_get_main (); u32 *result = va_arg (*args, u32 *); @@ -408,7 +408,7 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args) static uword api_unformat_hw_if_index (unformat_input_t * input, va_list * args) { - vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *); + vat_main_t *vam __clib_unused = va_arg (*args, vat_main_t *); vnet_main_t *vnm = vnet_get_main (); u32 *result = va_arg (*args, u32 *); @@ -562,12 +562,13 @@ unformat_flow_classify_table_type (unformat_input_t * input, va_list * va) return 1; } +#if (VPP_API_TEST_BUILTIN==0) + static const char *mfib_flag_names[] = MFIB_ENTRY_NAMES_SHORT; static const char *mfib_flag_long_names[] = MFIB_ENTRY_NAMES_LONG; static const char *mfib_itf_flag_long_names[] = MFIB_ITF_NAMES_LONG; static const char *mfib_itf_flag_names[] = MFIB_ITF_NAMES_SHORT; -#if (VPP_API_TEST_BUILTIN==0) uword unformat_mfib_itf_flags (unformat_input_t * input, va_list * args) { @@ -1045,8 +1046,8 @@ static void vl_api_sw_interface_event_t_handler } #endif -static void vl_api_sw_interface_event_t_handler_json - (vl_api_sw_interface_event_t * mp) +__clib_unused static void +vl_api_sw_interface_event_t_handler_json (vl_api_sw_interface_event_t * mp) { /* JSON output not supported */ } @@ -7264,14 +7265,11 @@ api_bd_ip_mac_add_del (vat_main_t * vam) vl_api_mac_address_t mac = { 0 }; unformat_input_t *i = vam->input; vl_api_bd_ip_mac_add_del_t *mp; - ip46_type_t type; u32 bd_id; - u8 is_ipv6 = 0; u8 is_add = 1; u8 bd_id_set = 0; u8 ip_set = 0; u8 mac_set = 0; - u8 macaddr[6]; int ret; @@ -7714,6 +7712,7 @@ api_virtio_pci_create (vat_main_t * vam) mp->pci_addr = htonl (pci_addr); mp->features = clib_host_to_net_u64 (features); + mp->gso_enabled = gso_enabled; if (random_mac == 0) clib_memcpy (mp->mac_address, mac_address, 6); @@ -10117,7 +10116,6 @@ api_sw_interface_ip6nd_ra_prefix (vat_main_t * vam) vl_api_sw_interface_ip6nd_ra_prefix_t *mp; u32 sw_if_index; u8 sw_if_index_set = 0; - u32 address_length = 0; u8 v6_address_set = 0; vl_api_prefix_t pfx; u8 use_default = 0; @@ -13228,8 +13226,6 @@ api_gre_tunnel_add_del (vat_main_t * vam) vl_api_gre_tunnel_add_del_t *mp; vl_api_gre_tunnel_type_t t_type; u8 is_add = 1; - u8 ipv4_set = 0; - u8 ipv6_set = 0; u8 src_set = 0; u8 dst_set = 0; u32 outer_fib_id = 0; @@ -13332,8 +13328,6 @@ static void vl_api_gre_tunnel_details_t_handler_json { vat_main_t *vam = &vat_main; vat_json_node_t *node = NULL; - struct in_addr ip4; - struct in6_addr ip6; if (VAT_JSON_ARRAY != vam->json_tree.type) { @@ -14167,7 +14161,7 @@ api_ip_probe_neighbor (vat_main_t * vam) { unformat_input_t *i = vam->input; vl_api_ip_probe_neighbor_t *mp; - vl_api_address_t dst_adr; + vl_api_address_t dst_adr = { }; u8 int_set = 0; u8 adr_set = 0; u32 sw_if_index; @@ -14179,7 +14173,7 @@ api_ip_probe_neighbor (vat_main_t * vam) int_set = 1; else if (unformat (i, "sw_if_index %d", &sw_if_index)) int_set = 1; - else if (unformat (i, "address %U", unformat_vl_api_address, dst_adr)) + else if (unformat (i, "address %U", unformat_vl_api_address, &dst_adr)) adr_set = 1; else break; @@ -14706,7 +14700,7 @@ api_ipsec_spd_entry_add_del (vat_main_t * vam) { unformat_input_t *i = vam->input; vl_api_ipsec_spd_entry_add_del_t *mp; - u8 is_add = 1, is_outbound = 0, is_ipv6 = 0, is_ip_any = 1; + u8 is_add = 1, is_outbound = 0; u32 spd_id = 0, sa_id = 0, protocol = 0, policy = 0; i32 priority = 0; u32 rport_start = 0, rport_stop = (u32) ~ 0; @@ -14746,16 +14740,16 @@ api_ipsec_spd_entry_add_del (vat_main_t * vam) ; else if (unformat (i, "laddr_start %U", unformat_vl_api_address, &laddr_start)) - is_ip_any = 0; + ; else if (unformat (i, "laddr_stop %U", unformat_vl_api_address, &laddr_stop)) - is_ip_any = 0; + ; else if (unformat (i, "raddr_start %U", unformat_vl_api_address, &raddr_start)) - is_ip_any = 0; + ; else if (unformat (i, "raddr_stop %U", unformat_vl_api_address, &raddr_stop)) - is_ip_any = 0; + ; else if (unformat (i, "action %U", unformat_ipsec_policy_action, &policy)) { @@ -14918,7 +14912,7 @@ api_ipsec_tunnel_if_add_del (vat_main_t * vam) u8 renumber = 0; u32 instance = ~0; u32 count = 1, jj; - int ret; + int ret = -1; while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { @@ -20026,7 +20020,6 @@ api_ip_source_and_port_range_check_add_del (vat_main_t * vam) u8 prefix_set = 0; u32 vrf_id = ~0; u8 is_add = 1; - u8 is_ipv6 = 0; int ret; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) @@ -20242,11 +20235,9 @@ api_set_punt (vat_main_t * vam) unformat_input_t *i = vam->input; vl_api_address_family_t af; vl_api_set_punt_t *mp; - u32 ipv = ~0; u32 protocol = ~0; u32 port = ~0; int is_add = 1; - u8 is_ip4 = 1; int ret; while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) @@ -20307,7 +20298,6 @@ static void vl_api_ipsec_gre_tunnel_details_t_handler_json { vat_main_t *vam = &vat_main; vat_json_node_t *node = NULL; - struct in_addr ip4; if (VAT_JSON_ARRAY != vam->json_tree.type) { diff --git a/src/vat/main.c b/src/vat/main.c index 92edec117b2..893a1022ab7 100644 --- a/src/vat/main.c +++ b/src/vat/main.c @@ -288,7 +288,6 @@ setup_signal_handlers (void) static void vat_find_plugin_path () { - extern char *vat_plugin_path; char *p, path[PATH_MAX]; int rv; u8 *s; diff --git a/src/vat/vat.h b/src/vat/vat.h index c9384a1ce57..c71446519a3 100644 --- a/src/vat/vat.h +++ b/src/vat/vat.h @@ -230,8 +230,8 @@ void do_one_file (vat_main_t * vam); int exec (vat_main_t * vam); /* Plugin API library functions */ -char *vat_plugin_path; -char *vat_plugin_name_filter; +extern char *vat_plugin_path; +extern char *vat_plugin_name_filter; void vat_plugin_api_reference (void); uword unformat_sw_if_index (unformat_input_t * input, va_list * args); uword unformat_ip4_address (unformat_input_t * input, va_list * args); diff --git a/src/vcl/vcl_test.h b/src/vcl/vcl_test.h index a5a8ad19488..ab05f7ae9cf 100644 --- a/src/vcl/vcl_test.h +++ b/src/vcl/vcl_test.h @@ -404,7 +404,7 @@ static inline int vcl_test_read (int fd, uint8_t * buf, uint32_t nbytes, vcl_test_stats_t * stats) { - int rx_bytes, errno_val; + int rx_bytes; do { @@ -443,7 +443,7 @@ vcl_test_read (int fd, uint8_t * buf, uint32_t nbytes, static inline int vcl_test_read_ds (int fd, vppcom_data_segments_t ds, vcl_test_stats_t * stats) { - int rx_bytes, errno_val; + int rx_bytes; do { diff --git a/src/vcl/vcl_test_client.c b/src/vcl/vcl_test_client.c index af953e547c5..42476ffbe01 100644 --- a/src/vcl/vcl_test_client.c +++ b/src/vcl/vcl_test_client.c @@ -62,7 +62,6 @@ vcl_test_client_main_t vcl_client_main; static int vtc_cfg_sync (vcl_test_session_t * ts) { - vcl_test_client_main_t *vcm = &vcl_client_main; vcl_test_cfg_t *rx_cfg = (vcl_test_cfg_t *) ts->rxbuf; int rx_bytes, tx_bytes; @@ -216,11 +215,10 @@ static int vtc_worker_init (vcl_test_client_worker_t * wrk) { vcl_test_client_main_t *vcm = &vcl_client_main; - vcl_test_session_t *ctrl = &vcm->ctrl_session; vcl_test_cfg_t *cfg = &wrk->cfg; vcl_test_session_t *ts; - uint32_t i, n; - int rv, nbytes; + uint32_t n; + int rv; __wrk_index = wrk->wrk_index; @@ -477,9 +475,7 @@ vtc_stream_client (vcl_test_client_main_t * vcm) vcl_test_session_t *ctrl = &vcm->ctrl_session; vcl_test_cfg_t *cfg = &ctrl->cfg; vcl_test_client_worker_t *wrk; - vcl_test_session_t *ts; - int tx_bytes, rv; - uint32_t i, n, sidx, n_conn, n_conn_per_wrk; + uint32_t i, n_conn, n_conn_per_wrk; vtinf ("%s-directional Stream Test Starting!", ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni"); @@ -989,7 +985,7 @@ main (int argc, char **argv) { vcl_test_client_main_t *vcm = &vcl_client_main; vcl_test_session_t *ctrl = &vcm->ctrl_session; - int rv, errno_val; + int rv; vcm->n_workers = 1; vcl_test_cfg_init (&ctrl->cfg); diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index b389a7a7a63..80449c64adc 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -287,8 +287,7 @@ get_thread_data (vl_api_thread_data_t * td, int index) static void vl_api_show_threads_t_handler (vl_api_show_threads_t * mp) { - vlib_main_t *vm = vlib_get_main (); - int rv = 0, count = 0; + int count = 0; #if !defined(__powerpc64__) vl_api_registration_t *reg; diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c index 129860538cf..af31307d229 100644 --- a/src/vpp/api/api_main.c +++ b/src/vpp/api/api_main.c @@ -127,7 +127,6 @@ api_command_fn (vlib_main_t * vm, u32 arg_len; int rv; int (*fp) (vat_main_t *); - api_main_t *am = &api_main; maybe_register_api_client (vam); @@ -278,6 +277,7 @@ uword unformat_sw_if_index (unformat_input_t * input, va_list * args) { void *vam_unused = va_arg (*args, void *); + (void) (vam_unused); u32 *result = va_arg (*args, u32 *); vnet_main_t *vnm = vnet_get_main (); u32 sw_if_index = ~0; diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index 32354e77e59..2c2c7ab06fc 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -119,7 +119,8 @@ static void *vl_api_sw_interface_set_flags_t_print FINISH; } -static void *vl_api_sw_interface_set_rx_placement_t_print +__clib_unused + static void *vl_api_sw_interface_set_rx_placement_t_print (vl_api_sw_interface_set_rx_placement_t * mp, void *handle) { u8 *s; @@ -136,7 +137,8 @@ static void *vl_api_sw_interface_set_rx_placement_t_print FINISH; } -static void *vl_api_sw_interface_rx_placement_dump_t_print +__clib_unused + static void *vl_api_sw_interface_rx_placement_dump_t_print (vl_api_sw_interface_rx_placement_dump_t * mp, void *handle) { u8 *s; @@ -528,7 +530,8 @@ static void *vl_api_bd_ip_mac_flush_t_print FINISH; } -static void *vl_api_bd_ip_mac_dump_t_print +__clib_unused + static void *vl_api_bd_ip_mac_dump_t_print (vl_api_bd_ip_mac_dump_t * mp, void *handle) { u8 *s; @@ -598,7 +601,8 @@ static void *vl_api_sw_interface_tap_v2_dump_t_print FINISH; } -static void *vl_api_virtio_pci_create_t_print +__clib_unused + static void *vl_api_virtio_pci_create_t_print (vl_api_virtio_pci_create_t * mp, void *handle) { u8 *s; @@ -618,7 +622,8 @@ static void *vl_api_virtio_pci_create_t_print FINISH; } -static void *vl_api_virtio_pci_delete_t_print +__clib_unused + static void *vl_api_virtio_pci_delete_t_print (vl_api_virtio_pci_delete_t * mp, void *handle) { u8 *s; @@ -629,7 +634,8 @@ static void *vl_api_virtio_pci_delete_t_print FINISH; } -static void *vl_api_sw_interface_virtio_pci_dump_t_print +__clib_unused + static void *vl_api_sw_interface_virtio_pci_dump_t_print (vl_api_sw_interface_virtio_pci_dump_t * mp, void *handle) { u8 *s; @@ -698,7 +704,8 @@ static void *vl_api_bond_detach_slave_t_print FINISH; } -static void *vl_api_sw_interface_bond_dump_t_print +__clib_unused + static void *vl_api_sw_interface_bond_dump_t_print (vl_api_sw_interface_bond_dump_t * mp, void *handle) { u8 *s; @@ -708,7 +715,8 @@ static void *vl_api_sw_interface_bond_dump_t_print FINISH; } -static void *vl_api_sw_interface_slave_dump_t_print +__clib_unused + static void *vl_api_sw_interface_slave_dump_t_print (vl_api_sw_interface_slave_dump_t * mp, void *handle) { u8 *s; @@ -1920,10 +1928,10 @@ static void *vl_api_gre_tunnel_add_del_t_print s = format (s, "instance %d ", ntohl (mp->tunnel.instance)); - if (mp->tunnel.type == GRE_TUNNEL_TYPE_TEB) + if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_TEB) s = format (s, "teb "); - if (mp->tunnel.type == GRE_TUNNEL_TYPE_ERSPAN) + if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_ERSPAN) s = format (s, "erspan %d ", ntohs (mp->tunnel.session_id)); if (mp->tunnel.outer_fib_id) @@ -2153,7 +2161,8 @@ static void *vl_api_show_version_t_print FINISH; } -static void *vl_api_show_threads_t_print +__clib_unused + static void *vl_api_show_threads_t_print (vl_api_show_threads_t * mp, void *handle) { u8 *s; @@ -3579,7 +3588,7 @@ static void *vl_api_tcp_configure_src_addresses_t_print static void *vl_api_app_namespace_add_del_t_print (vl_api_app_namespace_add_del_t * mp, void *handle) { - u8 *s, *ns_id = 0; + u8 *s; u8 len = clib_min (mp->namespace_id_len, ARRAY_LEN (mp->namespace_id) - 1); mp->namespace_id[len] = 0; @@ -3708,7 +3717,8 @@ static void *vl_api_session_rule_add_del_t_print FINISH; } -static void *vl_api_ip_container_proxy_add_del_t_print +__clib_unused + static void *vl_api_ip_container_proxy_add_del_t_print (vl_api_ip_container_proxy_add_del_t * mp, void *handle) { u8 *s; diff --git a/src/vpp/api/types.c b/src/vpp/api/types.c index 97dadbd4778..a4766c298c2 100644 --- a/src/vpp/api/types.c +++ b/src/vpp/api/types.c @@ -19,6 +19,9 @@ #include <vpp/api/types.h> #include <vat/vat.h> +const vl_api_mac_address_t VL_API_ZERO_MAC_ADDRESS; +const vl_api_address_t VL_API_ZERO_ADDRESS; + u8 * format_vl_api_address_family (u8 * s, va_list * args) { diff --git a/src/vpp/api/types.h b/src/vpp/api/types.h index a625e5d427a..40d80a09546 100644 --- a/src/vpp/api/types.h +++ b/src/vpp/api/types.h @@ -23,8 +23,8 @@ #include <vpp/api/vpe_all_api_h.h> #undef vl_typedefs -const vl_api_mac_address_t VL_API_ZERO_MAC_ADDRESS; -const vl_api_address_t VL_API_ZERO_ADDRESS; +extern const vl_api_mac_address_t VL_API_ZERO_MAC_ADDRESS; +extern const vl_api_address_t VL_API_ZERO_ADDRESS; extern uword unformat_vl_api_mac_address (unformat_input_t * input, va_list * args); extern uword unformat_vl_api_address_family (unformat_input_t * input, va_list * args); diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c index 3007889b666..61b21babbe3 100644 --- a/src/vpp/stats/stat_segment.c +++ b/src/vpp/stats/stat_segment.c @@ -158,7 +158,6 @@ vlib_stats_register_error_index (u8 * name, u64 * em_vec, u64 index) stat_segment_main_t *sm = &stat_segment_main; stat_segment_shared_header_t *shared_header = sm->shared_header; stat_segment_directory_entry_t e; - hash_pair_t *hp; ASSERT (shared_header); @@ -232,7 +231,6 @@ vlib_map_stat_segment_init (void) { stat_segment_main_t *sm = &stat_segment_main; stat_segment_shared_header_t *shared_header; - stat_segment_directory_entry_t *ep; void *oldheap; ssize_t memory_size; int mfd; @@ -348,13 +346,10 @@ show_stat_segment_command_fn (vlib_main_t * vm, vlib_cli_command_t * cmd) { stat_segment_main_t *sm = &stat_segment_main; - counter_t *counter; - hash_pair_t *p; - stat_segment_directory_entry_t *show_data, *this; - int i, j; + stat_segment_directory_entry_t *show_data; + int i; int verbose = 0; - u8 *s; if (unformat (input, "verbose")) verbose = 1; @@ -403,7 +398,6 @@ VLIB_CLI_COMMAND (show_stat_segment_command, static) = static inline void update_node_counters (stat_segment_main_t * sm) { - vlib_main_t *vm = vlib_mains[0]; vlib_main_t **stat_vms = 0; vlib_node_t ***node_dups = 0; int i, j; @@ -471,7 +465,6 @@ update_node_counters (stat_segment_main_t * sm) for (j = 0; j < vec_len (node_dups); j++) { vlib_node_t **nodes = node_dups[j]; - u32 l = vec_len (nodes); for (i = 0; i < vec_len (nodes); i++) { @@ -517,7 +510,7 @@ do_stat_segment_updates (stat_segment_main_t * sm) stat_segment_shared_header_t *shared_header = sm->shared_header; vlib_main_t *vm = vlib_mains[0]; f64 vector_rate; - u64 input_packets, last_input_packets; + u64 input_packets; f64 dt, now; vlib_main_t *this_vlib_main; int i, start; |