From 686191a1c9be0f6dcfe92782332c4507b70e37e1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 4 Apr 2014 12:56:34 +0200 Subject: oml: Fix compiler warning about aliasing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the fill_fom_hdr return the header and use it throughout. CC abis_nm.o In file included from ../../include/openbsc/debug.h:8:0, from abis_nm.c:38: abis_nm.c: In function ‘abis_nm_opstart’: abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’ #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) ^ abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’ #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) ^ abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’ #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) ^ abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’ #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) ^ abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ abis_nm.c:1763:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); ^ /home/ich/install/openbsc/include/osmocom/core/logging.h:23:74: note: in definition of macro ‘DEBUGP’ #define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) ^ abis_nm.c:1763:2: note: in expansion of macro ‘abis_nm_debugp_foh’ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); --- openbsc/src/libbsc/abis_nm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openbsc/src/libbsc/abis_nm.c') diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index c29e21b3d..3bf55ec56 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -93,7 +93,7 @@ static void fill_om_hdr(struct abis_om_hdr *oh, uint8_t len) oh->length = len; } -static void fill_om_fom_hdr(struct abis_om_hdr *oh, uint8_t len, +static struct abis_om_fom_hdr *fill_om_fom_hdr(struct abis_om_hdr *oh, uint8_t len, uint8_t msg_type, uint8_t obj_class, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) { @@ -106,6 +106,7 @@ static void fill_om_fom_hdr(struct abis_om_hdr *oh, uint8_t len, foh->obj_inst.bts_nr = bts_nr; foh->obj_inst.trx_nr = trx_nr; foh->obj_inst.ts_nr = ts_nr; + return foh; } static struct msgb *nm_msgb_alloc(void) @@ -1753,12 +1754,13 @@ static int __simple_cmd(struct gsm_bts *bts, uint8_t msg_type) int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2) { struct abis_om_hdr *oh; + struct abis_om_fom_hdr *foh; struct msgb *msg = nm_msgb_alloc(); oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE); - fill_om_fom_hdr(oh, 0, NM_MT_OPSTART, obj_class, i0, i1, i2); + foh = fill_om_fom_hdr(oh, 0, NM_MT_OPSTART, obj_class, i0, i1, i2); - abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data); + abis_nm_debugp_foh(DNM, foh); DEBUGPC(DNM, "Sending OPSTART\n"); return abis_nm_sendmsg(bts, msg); -- cgit v1.2.3