aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-04 12:56:34 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-04 12:56:34 +0200
commit686191a1c9be0f6dcfe92782332c4507b70e37e1 (patch)
treec77f307d583e673d211ebd84666bdd42f4050870
parent90e9a445c86d0929d4a58e35a8db13d745609ef0 (diff)
oml: Fix compiler warning about aliasing
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);
-rw-r--r--openbsc/src/libbsc/abis_nm.c8
1 files changed, 5 insertions, 3 deletions
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);