build: add -Wall and -fno-common, fix reported issues 89/19989/4
authorBenoît Ganne <bganne@cisco.com>
Tue, 30 Apr 2019 09:50:46 +0000 (11:50 +0200)
committerDamjan Marion <dmarion@me.com>
Fri, 7 Jun 2019 11:21:59 +0000 (11:21 +0000)
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:
build-data/platforms/vpp.mk
extras/libmemif/examples/icmp_responder-eb/main.c
extras/libmemif/examples/icmp_responder-epoll/main.c
extras/libmemif/examples/icmp_responder-mt/main.c
extras/libmemif/examples/icmp_responder-zero-copy-slave/main.c
extras/libmemif/examples/icmp_responder/icmp_proto.c
extras/libmemif/examples/icmp_responder/main.c
extras/libmemif/test/main_test.c
extras/libmemif/test/unit_test.c
src/cmake/cpu.cmake
src/cmake/library.cmake
src/cmake/plugin.cmake
src/plugins/flowprobe/flowprobe.c
src/plugins/flowprobe/flowprobe.h
src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
src/plugins/ioam/export/ioam_export_test.c
src/plugins/lacp/node.h
src/plugins/lb/lb_test.c
src/plugins/nsim/nsim_test.c
src/plugins/srv6-ad/ad.c
src/plugins/srv6-ad/ad.h
src/plugins/srv6-am/am.c
src/plugins/srv6-am/am.h
src/plugins/srv6-as/as.c
src/plugins/srv6-as/as.h
src/tests/vnet/session/udp_echo.c
src/vat/api_format.c
src/vat/main.c
src/vat/vat.h
src/vcl/vcl_test.h
src/vcl/vcl_test_client.c
src/vpp/api/api.c
src/vpp/api/api_main.c
src/vpp/api/custom_dump.c
src/vpp/api/types.c
src/vpp/api/types.h
src/vpp/stats/stat_segment.c

index 9748480..11ffdac 100644 (file)
@@ -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
index 9e71d28..646a6ca 100644 (file)
@@ -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;
index 02414fa..ecc05a4 100644 (file)
@@ -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));
index 8fa64cf..bc2f71d 100644 (file)
@@ -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;
index aad3303..7913588 100644 (file)
@@ -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));
index e1d255a..785aebd 100644 (file)
@@ -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;
index fa7bcb9..2e85d03 100644 (file)
@@ -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;
index e4697be..6c29bab 100644 (file)
@@ -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;
index a305de9..9c9a8d4 100644 (file)
@@ -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);
 
index df52053..e586ecc 100644 (file)
@@ -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}>)
index 747aeb4..18ab8ed 100644 (file)
@@ -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()
index 1565170..b18f337 100644 (file)
@@ -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()
index c130b90..45de3a7 100644 (file)
@@ -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);
index 92c3f90..2d28c81 100644 (file)
@@ -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);
index 85e1ee3..ff3f367 100644 (file)
@@ -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)
index 2af4eee..cd98877 100644 (file)
@@ -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)
index 88bc587..8bc7cf9 100644 (file)
@@ -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,
index cf55aec..00ad673 100644 (file)
@@ -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;
index 35f222e..e3c95c7 100644 (file)
@@ -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;
 
index 9cf9eb1..73ea3f6 100644 (file)
@@ -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 */
index ff00f84..e519cfb 100644 (file)
@@ -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;
index 9e3f2a3..2507a75 100644 (file)
@@ -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 */
index f9c8ba4..5d98a7e 100644 (file)
@@ -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;
index 7a982de..8cd964b 100644 (file)
@@ -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,
index 0eed05d..752d252 100644 (file)
@@ -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;
index 3a70d39..c9992be 100644 (file)
@@ -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);
index 5836e3c..be074be 100644 (file)
@@ -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)
     {
index 92edec1..893a102 100644 (file)
@@ -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;
index c9384a1..c714465 100644 (file)
@@ -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);
index a5a8ad1..ab05f7a 100644 (file)
@@ -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
     {
index af953e5..42476ff 100644 (file)
@@ -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);
index b389a7a..80449c6 100644 (file)
@@ -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;
index 1298605..af31307 100644 (file)
@@ -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;
index 32354e7..2c2c7ab 100644 (file)
@@ -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;
index 97dadbd..a4766c2 100644 (file)
@@ -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)
 {
index a625e5d..40d80a0 100644 (file)
@@ -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);
index 3007889..61b21ba 100644 (file)
@@ -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;