Skip to content

Commit

Permalink
Replace all ASSERT calls to DEBUGASSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiang781216 authored and gregory-nutt committed Aug 24, 2018
1 parent 220653f commit 5304ec5
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/cpuhog/cpuhog_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int cpuhog_main(int argc, char *argv[])

while (sem_wait(&g_state.sem) != 0)
{
ASSERT(errno == EINTR || errno == ECANCELED);
DEBUGASSERT(errno == EINTR || errno == ECANCELED);
}

/* Burn some inside semlock */
Expand Down
4 changes: 2 additions & 2 deletions examples/i2sloop/i2sloop_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int i2sloop_main(int argc, char *argv[])
/* Open the I2S character device */

fd = open("/dev/i2schar0", O_RDWR);
ASSERT(0 < fd);
DEBUGASSERT(0 < fd);

/* Setup sample freq for i2s */

Expand All @@ -127,7 +127,7 @@ int i2sloop_main(int argc, char *argv[])
desc.u.ppBuffer = &apb;

ret = apb_alloc(&desc);
ASSERT(ret == sizeof(desc));
DEBUGASSERT(ret == sizeof(desc));

signal(1, _signal_handler);
g_i2sloop_running = true;
Expand Down
2 changes: 1 addition & 1 deletion examples/nximage/nximage_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3703,7 +3703,7 @@ void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state)
*run++ = color;
}
}
ASSERT(width == SCALED_WIDTH);
DEBUGASSERT(width == SCALED_WIDTH);

/* Save the start of the next row and return success */

Expand Down
2 changes: 1 addition & 1 deletion examples/nxterm/nxterm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ int nxterm_main(int argc, char **argv)
g_nxterm_vars.pid = task_create("NxTerm", CONFIG_EXAMPLES_NXTERM_PRIO,
CONFIG_EXAMPLES_NXTERM_STACKSIZE,
nxterm_task, NULL);
ASSERT(g_nxterm_vars.pid > 0);
DEBUGASSERT(g_nxterm_vars.pid > 0);
return EXIT_SUCCESS;

/* Error Exits ************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion graphics/tiff/tiff_addstrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int tiff_convstrip(FAR struct tiff_info_s *info, FAR const uint8_t *strip)

ret = tiff_write(info->tmp2fd, info->iobuffer, nbytes);
#ifdef CONFIG_DEBUG_GRAPHICS
ASSERT(ntotal == info->bps);
DEBUGASSERT(ntotal == info->bps);
#endif
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions graphics/tiff/tiff_finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
#endif
}
#ifdef CONFIG_DEBUG_GRAPHICS
ASSERT(total == info->tmp1size);
DEBUGASSERT(total == info->tmp1size);
#endif

/* Rewind to the beginning of tmpfile2 */
Expand Down Expand Up @@ -399,7 +399,7 @@ int tiff_finalize(FAR struct tiff_info_s *info)
#endif
}
#ifdef CONFIG_DEBUG_GRAPHICS
ASSERT(total == info->tmp2size);
DEBUGASSERT(total == info->tmp2size);
#endif

/* Close all files and return success */
Expand Down
2 changes: 1 addition & 1 deletion graphics/tiff/tiff_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@

#ifdef CONFIG_DEBUG_TIFFOFFSETS
# define tiff_offset(o,l) (o) += (l)
# define tiff_checkoffs(o,x) ASSERT((o) == (x))
# define tiff_checkoffs(o,x) DEBUGASSERT((o) == (x))
#else
# define tiff_offset(o,l)
# define tiff_checkoffs(o,x)
Expand Down
2 changes: 1 addition & 1 deletion graphics/tiff/tiff_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ int tiff_putstring(int fd, FAR const char *string, int len)
#ifdef CONFIG_DEBUG_GRAPHICS
int actual = strlen(string);

ASSERT(len = actual+1);
DEBUGASSERT(len = actual+1);
#endif
return tiff_write(fd, string, len);
}
Expand Down
10 changes: 5 additions & 5 deletions modbus/ascii/mbascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static uint8_t prvucMBBIN2int8_t(uint8_t ucByte)
{
/* Programming error. */

ASSERT(0);
DEBUGASSERT(0);
}

return '0';
Expand Down Expand Up @@ -225,7 +225,7 @@ eMBErrorCode eMBASCIIReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame,
eMBErrorCode eStatus = MB_ENOERR;

ENTER_CRITICAL_SECTION();
ASSERT(usRcvBufferPos < MB_SER_PDU_SIZE_MAX);
DEBUGASSERT(usRcvBufferPos < MB_SER_PDU_SIZE_MAX);

/* Length and CRC check */

Expand Down Expand Up @@ -307,7 +307,7 @@ bool xMBASCIIReceiveFSM(void)
uint8_t ucByte;
uint8_t ucResult;

ASSERT(eSndState == STATE_TX_IDLE);
DEBUGASSERT(eSndState == STATE_TX_IDLE);

(void)xMBPortSerialGetByte((int8_t *) & ucByte);
switch (eRcvState)
Expand Down Expand Up @@ -435,7 +435,7 @@ bool xMBASCIITransmitFSM(void)
bool xNeedPoll = false;
uint8_t ucByte;

ASSERT(eRcvState == STATE_RX_IDLE);
DEBUGASSERT(eRcvState == STATE_RX_IDLE);
switch (eSndState)
{
/* Start of transmission. The start of a frame is defined by sending
Expand Down Expand Up @@ -537,7 +537,7 @@ bool xMBASCIITimerT1SExpired(void)
break;

default:
ASSERT((eRcvState == STATE_RX_RCV) || (eRcvState == STATE_RX_WAIT_EOF));
DEBUGASSERT((eRcvState == STATE_RX_RCV) || (eRcvState == STATE_RX_WAIT_EOF));
break;
}

Expand Down
4 changes: 2 additions & 2 deletions modbus/functions/mbutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void xMBUtilSetBits(uint8_t *ucByteBuf, uint16_t usBitOffset,
uint16_t usNPreBits;
uint16_t usValue = ucValue;

ASSERT(ucNBits <= 8);
ASSERT((size_t)BITS_uint8_t == sizeof(uint8_t) * 8);
DEBUGASSERT(ucNBits <= 8);
DEBUGASSERT((size_t)BITS_uint8_t == sizeof(uint8_t) * 8);

/* Calculate byte offset for first byte containing the bit values starting
* at usBitOffset.
Expand Down
6 changes: 3 additions & 3 deletions modbus/nuttx/portserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void vMBPortSerialEnable(bool bEnableRx, bool bEnableTx)
{
/* it is not allowed that both receiver and transmitter are enabled. */

ASSERT(!bEnableRx || !bEnableTx);
DEBUGASSERT(!bEnableRx || !bEnableTx);

if (bEnableRx)
{
Expand Down Expand Up @@ -387,15 +387,15 @@ bool xMBPortSerialPoll(void)

bool xMBPortSerialPutByte(int8_t ucByte)
{
ASSERT(uiTxBufferPos < BUF_SIZE);
DEBUGASSERT(uiTxBufferPos < BUF_SIZE);
ucBuffer[uiTxBufferPos] = ucByte;
uiTxBufferPos++;
return true;
}

bool xMBPortSerialGetByte(int8_t *pucByte)
{
ASSERT(uiRxBufferPos < BUF_SIZE);
DEBUGASSERT(uiRxBufferPos < BUF_SIZE);
*pucByte = ucBuffer[uiRxBufferPos];
uiRxBufferPos++;
return true;
Expand Down
6 changes: 3 additions & 3 deletions modbus/nuttx/portserial_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void vMBMasterPortSerialEnable(bool bEnableRx, bool bEnableTx)
{
/* it is not allowed that both receiver and transmitter are enabled. */

ASSERT(!bEnableRx || !bEnableTx);
DEBUGASSERT(!bEnableRx || !bEnableTx);

if (bEnableRx)
{
Expand Down Expand Up @@ -398,15 +398,15 @@ bool xMBMasterPortSerialPoll( void )

bool xMBMasterPortSerialPutByte(int8_t ucByte)
{
ASSERT(uiTxBufferPos < BUF_SIZE);
DEBUGASSERT(uiTxBufferPos < BUF_SIZE);
ucBuffer[uiTxBufferPos] = ucByte;
uiTxBufferPos++;
return true;
}

bool xMBMasterPortSerialGetByte(int8_t *pucByte)
{
ASSERT(uiRxBufferPos < BUF_SIZE);
DEBUGASSERT(uiRxBufferPos < BUF_SIZE);
*pucByte = ucBuffer[uiRxBufferPos];
uiRxBufferPos++;
return true;
Expand Down
2 changes: 1 addition & 1 deletion modbus/nuttx/porttimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void vMBPortTimersEnable()
{
int res = gettimeofday(&xTimeLast, NULL);

ASSERT(res == 0);
DEBUGASSERT(res == 0);
bTimeoutEnable = true;
}

Expand Down
2 changes: 1 addition & 1 deletion modbus/nuttx/porttimer_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void vMBMasterPortTimersEnable( void )
{
int res = gettimeofday(&xTimeLast, NULL);

ASSERT(res == 0);
DEBUGASSERT(res == 0);
bTimeoutEnable = true;
}

Expand Down
8 changes: 4 additions & 4 deletions modbus/rtu/mbrtu.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ eMBErrorCode eMBRTUReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame,
eMBErrorCode eStatus = MB_ENOERR;

ENTER_CRITICAL_SECTION();
ASSERT(usRcvBufferPos < MB_SER_PDU_SIZE_MAX);
DEBUGASSERT(usRcvBufferPos < MB_SER_PDU_SIZE_MAX);

/* Length and CRC check */

Expand Down Expand Up @@ -254,7 +254,7 @@ bool xMBRTUReceiveFSM(void)
bool xTaskNeedSwitch = false;
uint8_t ucByte;

ASSERT(eSndState == STATE_TX_IDLE);
DEBUGASSERT(eSndState == STATE_TX_IDLE);

/* Always read the character. */

Expand Down Expand Up @@ -320,7 +320,7 @@ bool xMBRTUTransmitFSM(void)
{
bool xNeedPoll = false;

ASSERT(eRcvState == STATE_RX_IDLE);
DEBUGASSERT(eRcvState == STATE_RX_IDLE);

switch (eSndState)
{
Expand Down Expand Up @@ -388,7 +388,7 @@ bool xMBRTUTimerT35Expired(void)
/* Function called in an illegal state. */

default:
ASSERT((eRcvState == STATE_RX_INIT) ||
DEBUGASSERT((eRcvState == STATE_RX_INIT) ||
(eRcvState == STATE_RX_RCV) ||
(eRcvState == STATE_RX_ERROR));
}
Expand Down
10 changes: 5 additions & 5 deletions modbus/rtu/mbrtu_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ eMBErrorCode eMBMasterRTUReceive(uint8_t *pucRcvAddress, uint8_t **pucFrame,
eMBErrorCode eStatus = MB_ENOERR;

ENTER_CRITICAL_SECTION();
ASSERT(usMasterRcvBufferPos < MB_SER_PDU_SIZE_MAX);
DEBUGASSERT(usMasterRcvBufferPos < MB_SER_PDU_SIZE_MAX);

/* Length and CRC check */

Expand Down Expand Up @@ -273,7 +273,7 @@ bool xMBMasterRTUReceiveFSM(void)
bool xTaskNeedSwitch = false;
uint8_t ucByte;

ASSERT((eSndState == STATE_M_TX_IDLE) ||
DEBUGASSERT((eSndState == STATE_M_TX_IDLE) ||
(eSndState == STATE_M_TX_XFWR));

/* Always read the character. */
Expand Down Expand Up @@ -347,7 +347,7 @@ bool xMBMasterRTUTransmitFSM(void)
{
bool xNeedPoll = false;

ASSERT(eRcvState == STATE_M_RX_IDLE);
DEBUGASSERT(eRcvState == STATE_M_RX_IDLE);

switch (eSndState)
{
Expand Down Expand Up @@ -432,7 +432,7 @@ bool xMBMasterRTUTimerExpired(void)
/* Function called in an illegal state. */

default:
ASSERT((eRcvState == STATE_M_RX_INIT) ||
DEBUGASSERT((eRcvState == STATE_M_RX_INIT) ||
(eRcvState == STATE_M_RX_RCV) ||
(eRcvState == STATE_M_RX_ERROR) ||
(eRcvState == STATE_M_RX_IDLE));
Expand All @@ -459,7 +459,7 @@ bool xMBMasterRTUTimerExpired(void)
/* Function called in an illegal state. */

default:
ASSERT((eSndState == STATE_M_TX_XFWR) ||
DEBUGASSERT((eSndState == STATE_M_TX_XFWR) ||
(eSndState == STATE_M_TX_IDLE));
break;
}
Expand Down
2 changes: 1 addition & 1 deletion netutils/thttpd/thttpd_cgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static inline void cgi_semtake(void)
* awakened by a signal.
*/

ASSERT(errno == EINTR || errno == ECANCELED);
DEBUGASSERT(errno == EINTR || errno == ECANCELED);
}
}

Expand Down
2 changes: 1 addition & 1 deletion system/nxplayer/nxplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static int _open_with_http(const char *fullurl)
}

s = socket(AF_INET, SOCK_STREAM, 0);
ASSERT(s != -1);
DEBUGASSERT(s != -1);

tv.tv_sec = 10; /* TODO */
tv.tv_usec = 0;
Expand Down
2 changes: 1 addition & 1 deletion system/taskset/taskset.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void show_usage(FAR const char *progname, int exitcode)

static bool get_cpuset(const char *arg, cpu_set_t *cpu_set)
{
ASSERT(NULL != arg);
DEBUGASSERT(NULL != arg);

bool ret = false;
int val = atoi(arg);
Expand Down

0 comments on commit 5304ec5

Please sign in to comment.