remove compilation warnings, especially when disabling T_TRACER. enhance LOG_M macro implementation, introduce LOG_DEBUG_XXX macro to replace #ifdef DEBUG_XXX

This commit is contained in:
frtabu
2018-07-30 20:07:22 +02:00
parent b85cbddeec
commit 30509955c2
55 changed files with 686 additions and 934 deletions
+9 -6
View File
@@ -74,7 +74,9 @@ Description Defines the EMMAS Service Access Point that provides
/*
* String representation of EMMAS-SAP primitives
*/
static const char *_emm_as_primitive_str[] = {
char *emmas_to_str(int emmas) {
static char *_emm_as_primitive_str[] = {
"EMMAS_SECURITY_REQ",
"EMMAS_SECURITY_IND",
"EMMAS_SECURITY_RES",
@@ -92,7 +94,8 @@ static const char *_emm_as_primitive_str[] = {
"EMMAS_CELL_INFO_RES",
"EMMAS_CELL_INFO_IND",
};
return _emm_as_primitive_str[emmas];
}
/*
* Functions executed to process EMM procedures upon receiving
* data from the network
@@ -195,7 +198,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
emm_as_primitive_t primitive = msg->primitive;
LOG_TRACE(INFO, "EMMAS-SAP - Received primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1], primitive);
emmas_to_str(primitive - _EMMAS_START - 1), primitive);
switch (primitive) {
case _EMMAS_DATA_IND:
@@ -234,7 +237,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMMAS-SAP - "
"Failed to process primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1],
emmas_to_str(primitive - _EMMAS_START - 1),
primitive);
LOG_FUNC_RETURN (RETURNerror);
}
@@ -266,7 +269,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMMAS-SAP - Failed to process primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1],
emmas_to_str(primitive - _EMMAS_START - 1),
primitive);
}
@@ -984,7 +987,7 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
LOG_TRACE(DEBUG, "EMMAS-SAP - "
"Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission",
as_msg.msgID,
_emm_as_primitive_str[msg->primitive - _EMMAS_START - 1],
emmas_to_str(msg->primitive - _EMMAS_START - 1),
msg->primitive);
switch (as_msg.msgID) {
+5 -2
View File
@@ -58,6 +58,7 @@ Description Defines the EMMESM Service Access Point that provides
/*
* String representation of EMMESM-SAP primitives
*/
const char *emm_esm_primitive2str(int esmprim) {
static const char *_emm_esm_primitive_str[] = {
"EMMESM_ESTABLISH_REQ",
"EMMESM_ESTABLISH_CNF",
@@ -66,6 +67,8 @@ static const char *_emm_esm_primitive_str[] = {
"EMMESM_UNITDATA_REQ",
"EMMESM_UNITDATA_IND",
};
return _emm_esm_primitive_str[esmprim];
}
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -116,7 +119,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
emm_esm_primitive_t primitive = msg->primitive;
LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
emm_esm_primitive2str(primitive - _EMMESM_START - 1), primitive);
switch (primitive) {
@@ -159,7 +162,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1],
emm_esm_primitive2str(primitive - _EMMESM_START - 1),
primitive);
}
+10 -7
View File
@@ -64,6 +64,7 @@ Description Defines the EPS Mobility Management procedures executed at
*/
/* String representation of EMM events */
const char *emm_fsm_event2str(int evt) {
static const char *_emm_fsm_event_str[] = {
"S1_ENABLED",
"S1_DISABLED",
@@ -93,7 +94,10 @@ static const char *_emm_fsm_event_str[] = {
"LOWERLAYER_FAILURE",
"LOWERLAYER_RELEASE",
};
return _emm_fsm_event_str[evt];
}
const char *emm_fsm_status2str(int status) {
/* String representation of EMM status */
static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"INVALID",
@@ -120,7 +124,8 @@ static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"TRACKING-AREA-UPDATING-INITIATED",
"SERVICE-REQUEST-INITIATED",
};
return _emm_fsm_status_str[status];
}
/*
* -----------------------------------------------------------------------------
* EPS Mobility Management state machine handlers
@@ -229,8 +234,8 @@ int emm_fsm_set_status(nas_user_t *user,
if ( status < EMM_STATE_MAX ) {
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
_emm_fsm_status_str[user->emm_fsm_status],
_emm_fsm_status_str[status]);
emm_fsm_status2str(user->emm_fsm_status),
emm_fsm_status2str(status));
if (status != user->emm_fsm_status) {
user->emm_fsm_status = status;
@@ -280,17 +285,15 @@ int emm_fsm_process(nas_user_t *user, const emm_reg_t *evt)
{
int rc;
emm_fsm_state_t status;
emm_reg_primitive_t primitive;
LOG_FUNC_IN;
primitive = evt->primitive;
status = user->emm_fsm_status;
LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
emm_fsm_event2str(evt->primitive - _EMMREG_START - 1), evt->primitive,
emm_fsm_status2str(status));
/* Execute the EMM state machine */