aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-12-19 16:28:36 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-20 10:23:44 +0000
commit6a7acc2f9a551011b190e11910d8bfd09d8c74a4 (patch)
treee3460ba4f3954aa2fd0d2cb7c6f5a4870c970be8
parentfc6397307682b9874cd734d2bfcba9f6ef4820a9 (diff)
Declare variables as external
non-external declarations in header files are generating multiple empty definitions of the same symbol. Change-Id: I7f3933404f79d08579468d0052c106731b57507c Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vlib-api/vlibapi/api.h2
-rw-r--r--vlib-api/vlibsocket/api.h2
-rw-r--r--vlib/vlib/buffer_funcs.h6
-rw-r--r--vlib/vlib/main.c2
-rw-r--r--vlib/vlib/main.h6
-rw-r--r--vlib/vlib/threads.c1
-rw-r--r--vlib/vlib/threads.h6
-rw-r--r--vlib/vlib/unix/plugin.h2
-rw-r--r--vlib/vlib/unix/unix.h2
-rw-r--r--vpp-api-test/vat/main.c2
-rw-r--r--vpp-api/python/pneum/test_pneum.c4
-rw-r--r--vpp/vpp-api/summary_stats_client.c3
-rw-r--r--vpp/vpp-api/test_client.c3
-rw-r--r--vpp/vpp-api/test_ha.c3
14 files changed, 31 insertions, 13 deletions
diff --git a/vlib-api/vlibapi/api.h b/vlib-api/vlibapi/api.h
index 52452526b9b..6274533580b 100644
--- a/vlib-api/vlibapi/api.h
+++ b/vlib-api/vlibapi/api.h
@@ -190,7 +190,7 @@ typedef struct
char *root_path;
} api_main_t;
-api_main_t api_main;
+extern api_main_t api_main;
typedef struct
{
diff --git a/vlib-api/vlibsocket/api.h b/vlib-api/vlibsocket/api.h
index 3a86bd0c533..79c0d08a682 100644
--- a/vlib-api/vlibsocket/api.h
+++ b/vlib-api/vlibsocket/api.h
@@ -46,7 +46,7 @@ typedef struct
i8 *input_buffer;
} socket_main_t;
-socket_main_t socket_main;
+extern socket_main_t socket_main;
void socksvr_add_pending_output (struct unix_file *uf,
struct vl_api_registration_ *cf,
diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h
index cfe568e32e9..75716eca7f6 100644
--- a/vlib/vlib/buffer_funcs.h
+++ b/vlib/vlib/buffer_funcs.h
@@ -676,9 +676,9 @@ vlib_buffer_init_two_for_free_list (vlib_buffer_t * _dst0,
}
#if CLIB_DEBUG > 0
-u32 *vlib_buffer_state_validation_lock;
-uword *vlib_buffer_state_validation_hash;
-void *vlib_buffer_state_heap;
+extern u32 *vlib_buffer_state_validation_lock;
+extern uword *vlib_buffer_state_validation_hash;
+extern void *vlib_buffer_state_heap;
#endif
static inline void
diff --git a/vlib/vlib/main.c b/vlib/vlib/main.c
index fc294a72621..6c6cad98bba 100644
--- a/vlib/vlib/main.c
+++ b/vlib/vlib/main.c
@@ -50,6 +50,8 @@ CJ_GLOBAL_LOG_PROTOTYPE;
speculative vector enqueues which overflow vector data in next frame. */
#define VLIB_FRAME_SIZE_ALLOC (VLIB_FRAME_SIZE + 4)
+u32 wraps;
+
always_inline u32
vlib_frame_bytes (u32 n_scalar_bytes, u32 n_vector_bytes)
{
diff --git a/vlib/vlib/main.h b/vlib/vlib/main.h
index 579ef09b255..d9ac1445ddd 100644
--- a/vlib/vlib/main.h
+++ b/vlib/vlib/main.h
@@ -176,7 +176,7 @@ typedef struct vlib_main_t
} vlib_main_t;
/* Global main structure. */
-vlib_main_t vlib_global_main;
+extern vlib_main_t vlib_global_main;
always_inline f64
vlib_time_now (vlib_main_t * vm)
@@ -278,7 +278,7 @@ vlib_last_vector_length_per_node (vlib_main_t * vm)
return n == 0 ? 0 : (f64) v / (f64) n;
}
-u32 wraps;
+extern u32 wraps;
always_inline void
vlib_increment_main_loop_counter (vlib_main_t * vm)
@@ -315,7 +315,7 @@ always_inline void vlib_set_queue_signal_callback
int vlib_main (vlib_main_t * vm, unformat_input_t * input);
/* Thread stacks, for os_get_cpu_number */
-u8 **vlib_thread_stacks;
+extern u8 **vlib_thread_stacks;
/* Number of thread stacks that the application needs */
u32 vlib_app_num_thread_stacks_needed (void) __attribute__ ((weak));
diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c
index fb84c676cb3..27b622f5137 100644
--- a/vlib/vlib/threads.c
+++ b/vlib/vlib/threads.c
@@ -51,6 +51,7 @@ vl (void *p)
return vec_len (p);
}
+vlib_worker_thread_t *vlib_worker_threads;
vlib_thread_main_t vlib_thread_main;
uword
diff --git a/vlib/vlib/threads.h b/vlib/vlib/threads.h
index fd09c31181c..34ab5be8650 100644
--- a/vlib/vlib/threads.h
+++ b/vlib/vlib/threads.h
@@ -18,7 +18,7 @@
#include <vlib/main.h>
#include <linux/sched.h>
-vlib_main_t **vlib_mains;
+extern vlib_main_t **vlib_mains;
void vlib_set_thread_name (char *name);
@@ -108,7 +108,7 @@ typedef struct
pthread_t thread_id;
} vlib_worker_thread_t;
-vlib_worker_thread_t *vlib_worker_threads;
+extern vlib_worker_thread_t *vlib_worker_threads;
typedef struct
{
@@ -322,7 +322,7 @@ typedef struct
} vlib_thread_main_t;
-vlib_thread_main_t vlib_thread_main;
+extern vlib_thread_main_t vlib_thread_main;
#define VLIB_REGISTER_THREAD(x,...) \
__VA_ARGS__ vlib_thread_registration_t x; \
diff --git a/vlib/vlib/unix/plugin.h b/vlib/vlib/unix/plugin.h
index e905263f232..c17053bd306 100644
--- a/vlib/vlib/unix/plugin.h
+++ b/vlib/vlib/unix/plugin.h
@@ -82,7 +82,7 @@ typedef struct
vlib_main_t *vlib_main;
} plugin_main_t;
-plugin_main_t vlib_plugin_main;
+extern plugin_main_t vlib_plugin_main;
int vlib_plugin_early_init (vlib_main_t * vm);
int vlib_load_new_plugins (plugin_main_t * pm, int from_early_init);
diff --git a/vlib/vlib/unix/unix.h b/vlib/vlib/unix/unix.h
index 69688a62b76..ea0d417b2b1 100644
--- a/vlib/vlib/unix/unix.h
+++ b/vlib/vlib/unix/unix.h
@@ -203,7 +203,7 @@ vlib_unix_get_main (void)
}
/* thread stack array; vec_len = max number of threads */
-u8 **vlib_thread_stacks;
+extern u8 **vlib_thread_stacks;
/* utils */
diff --git a/vpp-api-test/vat/main.c b/vpp-api-test/vat/main.c
index 8ba60e2b36d..76c4d3f7c2a 100644
--- a/vpp-api-test/vat/main.c
+++ b/vpp-api-test/vat/main.c
@@ -33,6 +33,8 @@ connect_to_vpe (char *name)
return 0;
}
+vlib_main_t vlib_global_main;
+vlib_main_t **vlib_mains;
void
vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
{
diff --git a/vpp-api/python/pneum/test_pneum.c b/vpp-api/python/pneum/test_pneum.c
index 62f4a7446d4..e873114fab9 100644
--- a/vpp-api/python/pneum/test_pneum.c
+++ b/vpp-api/python/pneum/test_pneum.c
@@ -45,6 +45,10 @@
#include <vpp-api/vpe_all_api_h.h>
#undef vl_typedefs
+/* we are not linking with vlib */
+vlib_main_t vlib_global_main;
+vlib_main_t **vlib_mains;
+
volatile int sigterm_received = 0;
volatile u32 result_ready;
volatile u16 result_msg_id;
diff --git a/vpp/vpp-api/summary_stats_client.c b/vpp/vpp-api/summary_stats_client.c
index cbfef48d123..54e16669c86 100644
--- a/vpp/vpp-api/summary_stats_client.c
+++ b/vpp/vpp-api/summary_stats_client.c
@@ -90,6 +90,9 @@ test_main_t test_main;
/*
* Satisfy external references when -lvlib is not available.
*/
+vlib_main_t vlib_global_main;
+vlib_main_t **vlib_mains;
+
void
vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
{
diff --git a/vpp/vpp-api/test_client.c b/vpp/vpp-api/test_client.c
index df608d4f9d0..e0d7054a686 100644
--- a/vpp/vpp-api/test_client.c
+++ b/vpp/vpp-api/test_client.c
@@ -87,6 +87,9 @@ test_main_t test_main;
/*
* Satisfy external references when -lvlib is not available.
*/
+vlib_main_t vlib_global_main;
+vlib_main_t **vlib_mains;
+
void
vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
{
diff --git a/vpp/vpp-api/test_ha.c b/vpp/vpp-api/test_ha.c
index 6353396df62..91364d8bc63 100644
--- a/vpp/vpp-api/test_ha.c
+++ b/vpp/vpp-api/test_ha.c
@@ -95,6 +95,9 @@ static void vl_api_control_ping_reply_t_handler
tm->pings_replied++;
}
+vlib_main_t vlib_global_main;
+vlib_main_t **vlib_mains;
+
void
vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
{