libc/assert: Reference the expression in all case

to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
This commit is contained in:
Xiang Xiao
2021-03-29 14:00:56 +08:00
parent d7adcfd2b9
commit 0d12e8bae5
19 changed files with 14 additions and 73 deletions
+2 -2
View File
@@ -506,10 +506,10 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
size_t usize = CONFIG_RAM_END - ubase;
int log2;
DEBUGASSERT(ubase < (uintptr_t)SRAM1_END);
DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END);
/* Adjust that size to account for MPU alignment requirements.
* NOTE that there is an implicit assumption that the SRAM1_END
* NOTE that there is an implicit assumption that the CONFIG_RAM_END
* is aligned to the MPU requirement.
*/
-2
View File
@@ -2892,9 +2892,7 @@ errout:
static int sam_epfree(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
{
#ifdef CONFIG_DEBUG_ASSERTIONS
struct sam_rhport_s *rhport = (struct sam_rhport_s *)drvr;
#endif
struct sam_eplist_s *eplist = (struct sam_eplist_s *)ep;
struct sam_ed_s *ed;
int ret;
-12
View File
@@ -444,9 +444,7 @@ struct sam_ssc_s
uintptr_t base; /* SSC controller register base address */
sem_t exclsem; /* Assures mutually exclusive access to SSC */
uint8_t datalen; /* Data width (8, 16, or 32) */
#ifdef CONFIG_DEBUG_FEATURES
uint8_t align; /* Log2 of data width (0, 1, or 3) */
#endif
uint8_t pid; /* Peripheral ID */
uint8_t rxfslen; /* RX frame sync length */
uint8_t txfslen; /* TX frame sync length */
@@ -2020,21 +2018,15 @@ static int ssc_checkwidth(struct sam_ssc_s *priv, int bits)
switch (bits)
{
case 8:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 0;
#endif
break;
case 16:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 1;
#endif
break;
case 32:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 3;
#endif
break;
default:
@@ -3215,9 +3207,7 @@ static void ssc0_configure(struct sam_ssc_s *priv)
priv->base = SAM_SSC0_VBASE;
priv->datalen = CONFIG_SAMA5_SSC0_DATALEN;
#ifdef CONFIG_DEBUG_FEATURES
priv->align = SAMA5_SSC0_DATAMASK;
#endif
priv->pid = SAM_PID_SSC0;
}
#endif
@@ -3356,9 +3346,7 @@ static void ssc1_configure(struct sam_ssc_s *priv)
priv->base = SAM_SSC1_VBASE;
priv->datalen = CONFIG_SAMA5_SSC1_DATALEN;
#ifdef CONFIG_DEBUG_FEATURES
priv->align = SAMA5_SSC1_DATAMASK;
#endif
priv->pid = SAM_PID_SSC1;
}
#endif
+1 -3
View File
@@ -1637,9 +1637,7 @@ static inline int sam_single(struct sam_xdmach_s *xdmach)
static inline int sam_multiple(struct sam_xdmach_s *xdmach)
{
struct sam_xdmac_s *xdmac = sam_controller(xdmach);
#ifdef CONFIG_DEBUG_ASSERTIONS
struct chnext_view1_s *llhead = xdmach->llhead;
#endif
uintptr_t paddr;
uint32_t regval;
@@ -1680,7 +1678,7 @@ static inline int sam_multiple(struct sam_xdmach_s *xdmach)
* REVIST: Using NDAIF=0. Is that correct?
*/
paddr = sam_physramaddr((uintptr_t)xdmach->llhead);
paddr = sam_physramaddr((uintptr_t)llhead);
sam_putdmach(xdmach, (uint32_t)paddr, SAM_XDMACH_CNDA_OFFSET);
/* 5. Program the CNDC register:
-12
View File
@@ -419,9 +419,7 @@ struct sam_ssc_s
uintptr_t base; /* SSC controller register base address */
sem_t exclsem; /* Assures mutually exclusive access to SSC */
uint8_t datalen; /* Data width (8, 16, or 32) */
#ifdef CONFIG_DEBUG_FEATURES
uint8_t align; /* Log2 of data width (0, 1, or 3) */
#endif
uint8_t pid; /* Peripheral ID */
uint8_t rxfslen; /* RX frame sync length */
uint8_t txfslen; /* TX frame sync length */
@@ -2001,21 +1999,15 @@ static int ssc_checkwidth(struct sam_ssc_s *priv, int bits)
switch (bits)
{
case 8:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 0;
#endif
break;
case 16:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 1;
#endif
break;
case 32:
#ifdef CONFIG_DEBUG_FEATURES
priv->align = 3;
#endif
break;
default:
@@ -3198,9 +3190,7 @@ static void ssc0_configure(struct sam_ssc_s *priv)
priv->base = SAM_SSC0_BASE;
priv->datalen = CONFIG_SAMV7_SSC0_DATALEN;
#ifdef CONFIG_DEBUG_FEATURES
priv->align = SAMV7_SSC0_DATAMASK;
#endif
priv->pid = SAM_PID_SSC0;
}
#endif
@@ -3339,9 +3329,7 @@ static void ssc1_configure(struct sam_ssc_s *priv)
priv->base = SAM_SSC1_BASE;
priv->datalen = CONFIG_SAMV7_SSC1_DATALEN;
#ifdef CONFIG_DEBUG_FEATURES
priv->align = SAMV7_SSC1_DATAMASK;
#endif
priv->pid = SAM_PID_SSC1;
}
#endif
+1 -3
View File
@@ -1331,9 +1331,7 @@ static inline int sam_single(struct sam_xdmach_s *xdmach)
static inline int sam_multiple(struct sam_xdmach_s *xdmach)
{
struct sam_xdmac_s *xdmac = sam_controller(xdmach);
#ifdef CONFIG_DEBUG_ASSERTIONS
struct chnext_view1_s *llhead = xdmach->llhead;
#endif
uintptr_t paddr;
uint32_t regval;
@@ -1374,7 +1372,7 @@ static inline int sam_multiple(struct sam_xdmach_s *xdmach)
* REVIST: Using NDAIF=0. Is that correct?
*/
paddr = sam_physramaddr((uintptr_t)xdmach->llhead);
paddr = sam_physramaddr((uintptr_t)llhead);
sam_putdmach(xdmach, (uint32_t)paddr, SAM_XDMACH_CNDA_OFFSET);
/* 5. Program the CNDC register:
-6
View File
@@ -295,9 +295,7 @@ struct stm32_i2s_s
sem_t exclsem; /* Assures mutually exclusive access to I2S */
bool initialized; /* Has I2S interface been initialized */
uint8_t datalen; /* Data width (8 or 16) */
#ifdef CONFIG_DEBUG_FEATURES
uint8_t align; /* Log2 of data width (0 or 1) */
#endif
uint8_t rxenab:1; /* True: RX transfers enabled */
uint8_t txenab:1; /* True: TX transfers enabled */
uint8_t i2sno:6; /* I2S controller number (0 or 1) */
@@ -1749,15 +1747,11 @@ static int i2s_checkwidth(struct stm32_i2s_s *priv, int bits)
switch (bits)
{
case 8:
#ifdef CONFIG_DEBUG
priv->align = 0;
#endif
break;
case 16:
#ifdef CONFIG_DEBUG
priv->align = 1;
#endif
break;
default:
+2 -7
View File
@@ -225,7 +225,7 @@ static void sim_process_tick(sq_entry_t *entry)
static int sim_max_delay(FAR struct oneshot_lowerhalf_s *lower,
FAR struct timespec *ts)
{
DEBUGASSERT(lower != NULL && ts != NULL);
DEBUGASSERT(ts != NULL);
ts->tv_sec = UINT_MAX;
ts->tv_nsec = NSEC_PER_SEC - 1;
@@ -335,12 +335,7 @@ static int sim_cancel(FAR struct oneshot_lowerhalf_s *lower,
static int sim_current(FAR struct oneshot_lowerhalf_s *lower,
FAR struct timespec *ts)
{
#ifdef CONFIG_DEBUG_ASSERTIONS
FAR struct sim_oneshot_lowerhalf_s *priv =
(FAR struct sim_oneshot_lowerhalf_s *)lower;
#endif
DEBUGASSERT(priv != NULL && ts != NULL);
DEBUGASSERT(ts != NULL);
sim_timer_current(ts);
-2
View File
@@ -368,7 +368,6 @@ static inline unsigned int noteram_next(unsigned int ndx,
*
****************************************************************************/
#ifdef CONFIG_DEBUG_ASSERTIONS
static unsigned int noteram_length(void)
{
unsigned int head = g_noteram_info.ni_head;
@@ -381,7 +380,6 @@ static unsigned int noteram_length(void)
return head - tail;
}
#endif
/****************************************************************************
* Name: noteram_unread_length
-4
View File
@@ -1241,10 +1241,6 @@ int apds9960_register(FAR const char *devpath,
{
int ret;
/* Sanity check */
DEBUGASSERT(i2c != NULL);
/* Initialize the APDS9960 device structure */
FAR struct apds9960_dev_s *priv =
@@ -308,9 +308,7 @@ int xbee_req_data(XBEEHANDLE xbee,
int index;
uint16_t apiframelen;
uint8_t frametype;
#ifdef CONFIG_DEBUG_ASSERTIONS
int prevoffs = frame->io_offset;
#endif
#ifdef CONFIG_XBEE_LOCKUP_WORKAROUND
int retries = XBEE_LOCKUP_SENDATTEMPTS;
#endif
@@ -1381,8 +1381,6 @@ int xbee_netdev_register(XBEEHANDLE xbee)
nxsem_init(&priv->xd_exclsem, 0, 1);
DEBUGASSERT(priv->xd_txpoll != NULL);
/* Set the network mask. */
xbeenet_netmask(dev);
+2 -2
View File
@@ -75,7 +75,7 @@
# define DEBUGVERIFY(f) VERIFY(f)
#else
# define DEBUGPANIC()
# define DEBUGASSERT(f)
# define DEBUGASSERT(f) UNUSED(f)
# define DEBUGVERIFY(f) ((void)(f))
#endif
@@ -85,7 +85,7 @@
*/
#ifdef NDEBUG
# define assert(f)
# define assert(f) UNUSED(f)
#else
# define assert(f) ASSERT(f)
#endif
+2 -8
View File
@@ -63,9 +63,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
{
FAR struct mm_heap_impl_s *heap_impl;
FAR struct mm_allocnode_s *node;
#ifdef CONFIG_DEBUG_ASSERTIONS
FAR struct mm_allocnode_s *prev;
#endif
size_t mxordblk = 0;
int ordblks = 0; /* Number of non-inuse chunks */
size_t uordblks = 0; /* Total allocated space */
@@ -86,9 +84,8 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
for (region = 0; region < heap_impl->mm_nregions; region++)
#endif
{
#ifdef CONFIG_DEBUG_ASSERTIONS
prev = NULL;
#endif
/* Visit each node in the region
* Retake the semaphore for each region to reduce latencies
*/
@@ -114,9 +111,8 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
}
else
{
#ifdef CONFIG_DEBUG_ASSERTIONS
FAR struct mm_freenode_s *fnode = (FAR void *)node;
#endif
DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
DEBUGASSERT(fnode->blink->flink == fnode);
DEBUGASSERT(fnode->blink->size <= fnode->size);
@@ -135,9 +131,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
DEBUGASSERT(prev == NULL ||
prev->size == (node->preceding & ~MM_ALLOC_BIT));
#ifdef CONFIG_DEBUG_ASSERTIONS
prev = node;
#endif
}
minfo("region=%d node=%p heapend=%p\n",
+1 -1
View File
@@ -70,7 +70,7 @@
*
****************************************************************************/
#if defined(CONFIG_DEBUG_ASSERTIONS) && CONFIG_NET_BLUETOOTH_BACKLOG > 0
#if CONFIG_NET_BLUETOOTH_BACKLOG > 0
static int bluetooth_count_frames(FAR struct bluetooth_conn_s *conn)
{
FAR struct bluetooth_container_s *container;
+1 -1
View File
@@ -82,7 +82,7 @@ struct bluetooth_recvfrom_s
*
****************************************************************************/
#if defined(CONFIG_DEBUG_ASSERTIONS) && CONFIG_NET_BLUETOOTH_BACKLOG > 0
#if CONFIG_NET_BLUETOOTH_BACKLOG > 0
static int bluetooth_count_frames(FAR struct bluetooth_conn_s *conn)
{
FAR struct bluetooth_container_s *container;
+1 -1
View File
@@ -69,7 +69,7 @@
*
****************************************************************************/
#if defined(CONFIG_DEBUG_ASSERTIONS) && CONFIG_NET_IEEE802154_BACKLOG > 0
#if CONFIG_NET_IEEE802154_BACKLOG > 0
static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn)
{
FAR struct ieee802154_container_s *container;
+1 -1
View File
@@ -80,7 +80,7 @@ struct ieee802154_recvfrom_s
*
****************************************************************************/
#if defined(CONFIG_DEBUG_ASSERTIONS) && CONFIG_NET_IEEE802154_BACKLOG > 0
#if CONFIG_NET_IEEE802154_BACKLOG > 0
static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn)
{
FAR struct ieee802154_container_s *container;
-2
View File
@@ -1376,8 +1376,6 @@ int mac802154netdev_register(MACHANDLE mac)
nxsem_init(&priv->md_exclsem, 0, 1);
DEBUGASSERT(priv->md_txpoll != NULL);
/* Set the network mask. */
macnet_netmask(dev);