Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c openair1/PHY/LTE_TRANSPORT/dci.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/dlsch_coding.c openair1/PHY/LTE_TRANSPORT/edci.c openair1/PHY/LTE_TRANSPORT/if4_tools.c openair1/PHY/LTE_TRANSPORT/prach.c openair1/PHY/LTE_TRANSPORT/print_stats.c openair1/PHY/LTE_TRANSPORT/pucch.c openair1/PHY/LTE_TRANSPORT/transport_eNB.h openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h openair1/PHY/impl_defs_lte.h openair1/SCHED/fapi_l1.c openair1/SCHED/phy_procedures_lte_eNb.c openair2/COMMON/rrc_messages_types.h openair2/ENB_APP/enb_config.c openair2/ENB_APP/enb_paramdef.h openair2/LAYER2/MAC/config.c openair2/LAYER2/MAC/defs.h openair2/LAYER2/MAC/eNB_scheduler.c openair2/LAYER2/MAC/eNB_scheduler_RA.c openair2/LAYER2/MAC/eNB_scheduler_bch.c openair2/LAYER2/MAC/eNB_scheduler_dlsch.c openair2/LAYER2/MAC/eNB_scheduler_primitives.c openair2/LAYER2/MAC/eNB_scheduler_ulsch.c openair2/LAYER2/MAC/pre_processor.c openair2/LAYER2/MAC/rar_tools.c openair2/LAYER2/MAC/ue_procedures.c openair2/PHY_INTERFACE/IF_Module.c openair2/RRC/LITE/rrc_common.c openair2/RRC/LTE/L2_interface_ue.c openair2/RRC/LTE/MESSAGES/asn1_msg.c openair2/RRC/LTE/rrc_eNB.c targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp targets/RT/USER/lte-enb.c targets/RT/USER/lte-ru.c
91 lines
3.8 KiB
C
Executable File
91 lines
3.8 KiB
C
Executable File
/*
|
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership.
|
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.openairinterface.org/?page_id=698
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*-------------------------------------------------------------------------------
|
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
* contact@openairinterface.org
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <inttypes.h>
|
|
#ifdef CMAKER
|
|
#include <platform_types.h>
|
|
#endif
|
|
|
|
#if defined(ENB_MODE)
|
|
# define display_backtrace()
|
|
#else
|
|
# include "backtrace.h"
|
|
#endif
|
|
|
|
#ifndef ASSERTIONS_H_
|
|
#define ASSERTIONS_H_
|
|
|
|
void output_log_mem(void);
|
|
#define _Assert_Exit_ \
|
|
{ \
|
|
fprintf(stderr, "\nExiting execution\n"); \
|
|
display_backtrace(); \
|
|
fflush(stdout); \
|
|
fflush(stderr); \
|
|
exit(EXIT_FAILURE); \
|
|
}
|
|
|
|
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
|
|
do { \
|
|
if (!(cOND)) { \
|
|
fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \
|
|
"In %s() %s:%d\n" fORMAT, \
|
|
__FUNCTION__, __FILE__, __LINE__, ##aRGS); \
|
|
aCTION; \
|
|
} \
|
|
} while(0)
|
|
|
|
#define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, _Assert_Exit_, fORMAT, ##aRGS)
|
|
|
|
#define AssertError(cOND, aCTION, fORMAT, aRGS...) _Assert_(cOND, aCTION, fORMAT, ##aRGS)
|
|
|
|
|
|
|
|
#define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \
|
|
_Assert_(cOND, _Assert_Exit_, #vALUE1 ": %" PRIdMAX "\n" #vALUE2 ": %" PRIdMAX "\n" #vALUE3 ": %" PRIdMAX "\n\n", \
|
|
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3)
|
|
|
|
#define DevCheck4(cOND, vALUE1, vALUE2, vALUE3, vALUE4) \
|
|
_Assert_(cOND, _Assert_Exit_, #vALUE1": %" PRIdMAX "\n" #vALUE2 ": %" PRIdMAX "\n" #vALUE3 ": %" PRIdMAX "\n" #vALUE4 ": %" PRIdMAX "\n\n", \
|
|
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3, (intmax_t)vALUE4)
|
|
|
|
#define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3)
|
|
|
|
#define DevAssert(cOND) _Assert_(cOND, _Assert_Exit_, "")
|
|
|
|
#define DevMessage(mESSAGE) _Assert_(0, _Assert_Exit_, #mESSAGE)
|
|
|
|
#define CHECK_INIT_RETURN(fCT) \
|
|
do { \
|
|
int fct_ret; \
|
|
if ((fct_ret = (fCT)) != 0) { \
|
|
fprintf(stderr, "Function "#fCT" has failed\n" \
|
|
"returning %d\n", fct_ret); \
|
|
fflush(stdout); \
|
|
fflush(stderr); \
|
|
exit(EXIT_FAILURE); \
|
|
} \
|
|
} while(0)
|
|
|
|
#endif /* ASSERTIONS_H_ */
|