Fix OneDefinitionRule Asan violation in tests and osmo-hnbgw

With new gcc 10.1.0, tests failed at runtime when built with ASAN
enabled, since some global variables where defined multiple times.
See OS#4556 for a sample Asan error.

Fixes: OS#4556
Change-Id: I12a667ea8a9f16404c13c9218b246d2e3acfe3e8
This commit is contained in:
Pau Espin 2020-05-18 10:34:43 +02:00 committed by laforge
parent 6f66feb42d
commit 4f35665b9f
5 changed files with 6 additions and 10 deletions

View File

@ -106,10 +106,6 @@ char *hnbap_cause_str(Cause_t *cause)
return buf;
}
int asn_debug = 0;
int asn1_xer_print = 0;
static struct msgb *hnbap_msgb_alloc(void)
{
return msgb_alloc(1024, "HNBAP Tx");

View File

@ -26,7 +26,6 @@
#include <osmocom/ranap/ranap_msg_factory.h>
#include <osmocom/iuh/hnbgw.h>
int asn1_xer_print = 1;
const char *cmdline_bind_addr = "127.0.0.1";
struct ue_conn_ctx {
@ -364,6 +363,8 @@ int main(int argc, char **argv)
int rc;
int port = 14001;
asn1_xer_print = 1;
osmo_sua_set_log_area(DSUA);
ranap_set_log_area(DRANAP);

View File

@ -32,7 +32,6 @@
#include <osmocom/ranap/RANAP_LAI.h>
int asn1_xer_print = 0;
extern void *talloc_asn1_ctx;
/* use odd number of digits */
@ -207,6 +206,8 @@ void test_ranap_common(void)
int main(int argc, char **argv)
{
asn1_xer_print = 0;
test_common_init();
test_iu_helpers();

View File

@ -34,8 +34,6 @@
#include <osmocom/iuh/hnbgw.h>
int asn1_xer_print = 1;
extern void *tall_msgb_ctx;
static void test_aper_int(uint32_t inp)
@ -95,6 +93,8 @@ int main(int argc, char **argv)
uint8_t ck[16] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
int i;
asn1_xer_print = 1;
//asn_debug = 1;
test_common_init();

View File

@ -41,8 +41,6 @@
#include <osmocom/iuh/hnbgw.h>
void *talloc_asn1_ctx;
static const struct log_info_cat log_cat[] = {
[DMAIN] = {
.name = "DMAIN", .loglevel = LOGL_INFO, .enabled = 1,