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);
This commit is contained in:
parent
90e9a445c8
commit
686191a1c9
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue