Replace all asserts in kernel code with ASSERT
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
f25a506f91
commit
20ebe0e64c
@ -313,7 +313,7 @@ static int arm_gic_send_sgi(unsigned int sgi_id, uint64_t target_aff,
|
|||||||
uint32_t aff1;
|
uint32_t aff1;
|
||||||
uint64_t sgi_val;
|
uint64_t sgi_val;
|
||||||
|
|
||||||
assert(GIC_IS_SGI(sgi_id));
|
ASSERT(GIC_IS_SGI(sgi_id));
|
||||||
|
|
||||||
/* Extract affinity fields from target */
|
/* Extract affinity fields from target */
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ static void gicv3_cpuif_init(void)
|
|||||||
CP15_SET(ICC_SRE, icc_sre);
|
CP15_SET(ICC_SRE, icc_sre);
|
||||||
icc_sre = CP15_GET(ICC_SRE);
|
icc_sre = CP15_GET(ICC_SRE);
|
||||||
|
|
||||||
assert(icc_sre & ICC_SRE_ELX_SRE_BIT);
|
ASSERT(icc_sre & ICC_SRE_ELX_SRE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
CP15_SET(ICC_PMR, GIC_IDLE_PRIO);
|
CP15_SET(ICC_PMR, GIC_IDLE_PRIO);
|
||||||
|
@ -370,7 +370,7 @@ static uint32_t imxrt_flexspi_configure_dll(struct flexspi_type_s *base,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ static int imxrt_flexspi_check_and_clear_error(struct flexspi_type_s *base,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the flags */
|
/* Clear the flags */
|
||||||
@ -808,7 +808,7 @@ void imxrt_flexspi_update_lut_private(struct flexspi_type_s *base,
|
|||||||
const uint32_t *cmd,
|
const uint32_t *cmd,
|
||||||
uint32_t count)
|
uint32_t count)
|
||||||
{
|
{
|
||||||
assert(index < 64u);
|
ASSERT(index < 64u);
|
||||||
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
volatile uint32_t *lut_base;
|
volatile uint32_t *lut_base;
|
||||||
|
@ -372,7 +372,7 @@ void lc823450_gpio_write(uint16_t gpiocfg, bool value)
|
|||||||
#ifdef CONFIG_LC823450_VGPIO
|
#ifdef CONFIG_LC823450_VGPIO
|
||||||
if (port == (GPIO_PORTV >> GPIO_PORT_SHIFT))
|
if (port == (GPIO_PORTV >> GPIO_PORT_SHIFT))
|
||||||
{
|
{
|
||||||
assert(pin < GPIO_VIRTUAL_NUM);
|
ASSERT(pin < GPIO_VIRTUAL_NUM);
|
||||||
if (vgpio_ops[pin] && vgpio_ops[pin]->write)
|
if (vgpio_ops[pin] && vgpio_ops[pin]->write)
|
||||||
{
|
{
|
||||||
vgpio_ops[pin]->write(pin, value);
|
vgpio_ops[pin]->write(pin, value);
|
||||||
@ -437,7 +437,7 @@ bool lc823450_gpio_read(uint16_t gpiocfg)
|
|||||||
#ifdef CONFIG_LC823450_VGPIO
|
#ifdef CONFIG_LC823450_VGPIO
|
||||||
if (port == (GPIO_PORTV >> GPIO_PORT_SHIFT))
|
if (port == (GPIO_PORTV >> GPIO_PORT_SHIFT))
|
||||||
{
|
{
|
||||||
assert(pin < GPIO_VIRTUAL_NUM);
|
ASSERT(pin < GPIO_VIRTUAL_NUM);
|
||||||
if (vgpio_ops[pin] && vgpio_ops[pin]->read)
|
if (vgpio_ops[pin] && vgpio_ops[pin]->read)
|
||||||
{
|
{
|
||||||
return vgpio_ops[pin]->read(pin);
|
return vgpio_ops[pin]->read(pin);
|
||||||
@ -506,7 +506,7 @@ int lc823450_gpio_initialize(void)
|
|||||||
#ifdef CONFIG_LC823450_VGPIO
|
#ifdef CONFIG_LC823450_VGPIO
|
||||||
int lc823450_vgpio_register(unsigned int pin, struct vgpio_ops_s *ops)
|
int lc823450_vgpio_register(unsigned int pin, struct vgpio_ops_s *ops)
|
||||||
{
|
{
|
||||||
assert(pin < GPIO_VIRTUAL_NUM);
|
ASSERT(pin < GPIO_VIRTUAL_NUM);
|
||||||
vgpio_ops[pin] = ops;
|
vgpio_ops[pin] = ops;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ static void phyplus_setcallback(struct timer_lowerhalf_s *lower,
|
|||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
assert(ret == OK);
|
ASSERT(ret == OK);
|
||||||
|
|
||||||
/* #if 0
|
/* #if 0
|
||||||
* irqstate_t flags = enter_critical_section();
|
* irqstate_t flags = enter_critical_section();
|
||||||
|
@ -111,7 +111,7 @@ bool rp2040_clock_configure(int clk_index,
|
|||||||
{
|
{
|
||||||
uint32_t div;
|
uint32_t div;
|
||||||
|
|
||||||
assert(src_freq >= freq);
|
ASSERT(src_freq >= freq);
|
||||||
|
|
||||||
if (freq > src_freq)
|
if (freq > src_freq)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ static int hw_claim_unused_from_range(uint8_t *bits, bool required,
|
|||||||
static void hw_claim_clear(uint8_t *bits, uint32_t bit_index)
|
static void hw_claim_clear(uint8_t *bits, uint32_t bit_index)
|
||||||
{
|
{
|
||||||
uint32_t save = hw_claim_lock();
|
uint32_t save = hw_claim_lock();
|
||||||
assert(bits[bit_index >> 3u] & (1u << (bit_index & 7u)));
|
ASSERT(bits[bit_index >> 3u] & (1u << (bit_index & 7u)));
|
||||||
bits[bit_index >> 3u] &= (uint8_t) ~(1u << (bit_index & 7u));
|
bits[bit_index >> 3u] &= (uint8_t) ~(1u << (bit_index & 7u));
|
||||||
hw_claim_unlock(save);
|
hw_claim_unlock(save);
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ static void hw_claim_clear(uint8_t *bits, uint32_t bit_index)
|
|||||||
static int _pio_find_offset_for_program(uint32_t pio,
|
static int _pio_find_offset_for_program(uint32_t pio,
|
||||||
const rp2040_pio_program_t *program)
|
const rp2040_pio_program_t *program)
|
||||||
{
|
{
|
||||||
assert(program->length < PIO_INSTRUCTION_COUNT);
|
ASSERT(program->length < PIO_INSTRUCTION_COUNT);
|
||||||
uint32_t used_mask = _used_instruction_space[rp2040_pio_get_index(pio)];
|
uint32_t used_mask = _used_instruction_space[rp2040_pio_get_index(pio)];
|
||||||
uint32_t program_mask = (1u << program->length) - 1;
|
uint32_t program_mask = (1u << program->length) - 1;
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ void rp2040_pio_remove_program(uint32_t pio,
|
|||||||
uint32_t program_mask = (1u << program->length) - 1;
|
uint32_t program_mask = (1u << program->length) - 1;
|
||||||
program_mask <<= loaded_offset;
|
program_mask <<= loaded_offset;
|
||||||
uint32_t save = hw_claim_lock();
|
uint32_t save = hw_claim_lock();
|
||||||
assert(program_mask ==
|
ASSERT(program_mask ==
|
||||||
(_used_instruction_space[rp2040_pio_get_index(pio)] &
|
(_used_instruction_space[rp2040_pio_get_index(pio)] &
|
||||||
program_mask));
|
program_mask));
|
||||||
_used_instruction_space[rp2040_pio_get_index(pio)] &= ~program_mask;
|
_used_instruction_space[rp2040_pio_get_index(pio)] &= ~program_mask;
|
||||||
|
@ -143,11 +143,11 @@ inline static uint32_t _pio_encode_instr_and_args(
|
|||||||
uint32_t major = _pio_major_instr_bits(instr_bits);
|
uint32_t major = _pio_major_instr_bits(instr_bits);
|
||||||
if (major == pio_instr_bits_in || major == pio_instr_bits_out)
|
if (major == pio_instr_bits_in || major == pio_instr_bits_out)
|
||||||
{
|
{
|
||||||
assert(arg2 && arg2 <= 32);
|
ASSERT(arg2 && arg2 <= 32);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(arg2 <= 31);
|
ASSERT(arg2 <= 31);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return instr_bits | (arg1 << 5u) | (arg2 & 0x1fu);
|
return instr_bits | (arg1 << 5u) | (arg2 & 0x1fu);
|
||||||
|
@ -91,11 +91,11 @@ void rp2040_pll_init(uint32_t base, uint32_t refdiv, uint32_t vco_freq,
|
|||||||
|
|
||||||
/* Check parameter ranges */
|
/* Check parameter ranges */
|
||||||
|
|
||||||
assert(fbdiv >= 16 && fbdiv <= 320);
|
ASSERT(fbdiv >= 16 && fbdiv <= 320);
|
||||||
assert((post_div1 >= 1 && post_div1 <= 7) &&
|
ASSERT((post_div1 >= 1 && post_div1 <= 7) &&
|
||||||
(post_div2 >= 1 && post_div2 <= 7));
|
(post_div2 >= 1 && post_div2 <= 7));
|
||||||
assert(post_div2 <= post_div1);
|
ASSERT(post_div2 <= post_div1);
|
||||||
assert(ref_mhz <= (vco_freq / 16));
|
ASSERT(ref_mhz <= (vco_freq / 16));
|
||||||
|
|
||||||
/* Put calculated value into feedback divider */
|
/* Put calculated value into feedback divider */
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void rp2040_xosc_init(void)
|
|||||||
{
|
{
|
||||||
/* Assumes 1-15 MHz input */
|
/* Assumes 1-15 MHz input */
|
||||||
|
|
||||||
assert(BOARD_XOSC_FREQ <= (15 * MHZ));
|
ASSERT(BOARD_XOSC_FREQ <= (15 * MHZ));
|
||||||
putreg32(RP2040_XOSC_CTRL_FREQ_RANGE_1_15MHZ, RP2040_XOSC_CTRL);
|
putreg32(RP2040_XOSC_CTRL_FREQ_RANGE_1_15MHZ, RP2040_XOSC_CTRL);
|
||||||
|
|
||||||
/* Set xosc startup delay */
|
/* Set xosc startup delay */
|
||||||
|
@ -757,7 +757,7 @@ static int tiva_pwm_ioctl(struct pwm_lowerhalf_s *dev, int cmd,
|
|||||||
|
|
||||||
struct pwm_lowerhalf_s *tiva_pwm_initialize(int channel)
|
struct pwm_lowerhalf_s *tiva_pwm_initialize(int channel)
|
||||||
{
|
{
|
||||||
assert(channel >= 0 && channel <= 7);
|
ASSERT(channel >= 0 && channel <= 7);
|
||||||
struct tiva_pwm_chan_s *chan;
|
struct tiva_pwm_chan_s *chan;
|
||||||
|
|
||||||
switch (channel)
|
switch (channel)
|
||||||
@ -824,7 +824,7 @@ struct pwm_lowerhalf_s *tiva_pwm_initialize(int channel)
|
|||||||
|
|
||||||
/* Enable PWM controller (refer to TM4C1294NCPDT 23.4.1) */
|
/* Enable PWM controller (refer to TM4C1294NCPDT 23.4.1) */
|
||||||
|
|
||||||
assert(chan->controller_id == 0);
|
ASSERT(chan->controller_id == 0);
|
||||||
tiva_pwm_enablepwr(chan->controller_id);
|
tiva_pwm_enablepwr(chan->controller_id);
|
||||||
tiva_pwm_enableclk(chan->controller_id);
|
tiva_pwm_enableclk(chan->controller_id);
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ static int arm64_gic_send_sgi(unsigned int sgi_id, uint64_t target_aff,
|
|||||||
unsigned long base;
|
unsigned long base;
|
||||||
|
|
||||||
base = gic_get_rdist() + GICR_SGI_BASE_OFF;
|
base = gic_get_rdist() + GICR_SGI_BASE_OFF;
|
||||||
assert(GIC_IS_SGI(sgi_id));
|
ASSERT(GIC_IS_SGI(sgi_id));
|
||||||
|
|
||||||
/* Extract affinity fields from target */
|
/* Extract affinity fields from target */
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ static void gicv3_cpuif_init(void)
|
|||||||
write_sysreg(icc_sre, ICC_SRE_EL1);
|
write_sysreg(icc_sre, ICC_SRE_EL1);
|
||||||
icc_sre = read_sysreg(ICC_SRE_EL1);
|
icc_sre = read_sysreg(ICC_SRE_EL1);
|
||||||
|
|
||||||
assert(icc_sre & ICC_SRE_ELX_SRE_BIT);
|
ASSERT(icc_sre & ICC_SRE_ELX_SRE_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_sysreg(GIC_IDLE_PRIO, ICC_PMR_EL1);
|
write_sysreg(GIC_IDLE_PRIO, ICC_PMR_EL1);
|
||||||
|
@ -933,7 +933,7 @@ void *bl_os_timer_create(void *func, void *argv)
|
|||||||
struct timer_adpt *timer = kmm_malloc(sizeof(struct timer_adpt));
|
struct timer_adpt *timer = kmm_malloc(sizeof(struct timer_adpt));
|
||||||
if (!timer)
|
if (!timer)
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((void *)timer, 0, sizeof(struct timer_adpt));
|
memset((void *)timer, 0, sizeof(struct timer_adpt));
|
||||||
@ -1066,7 +1066,7 @@ void *bl_os_workqueue_create(void)
|
|||||||
struct work_s *work = kmm_calloc(1, sizeof(struct work_s));
|
struct work_s *work = kmm_calloc(1, sizeof(struct work_s));
|
||||||
if (!work)
|
if (!work)
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)work;
|
return (void *)work;
|
||||||
|
@ -340,7 +340,7 @@ static int rt_timer_thread(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
tmrerr("ERROR: Wait toutsem error=%d\n", ret);
|
tmrerr("ERROR: Wait toutsem error=%d\n", ret);
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
@ -1612,7 +1612,7 @@ psram_enable(int mode, int vaddrmode) /* psram init */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(mode < PSRAM_CACHE_MAX && "we don't support any other mode.");
|
ASSERT(mode < PSRAM_CACHE_MAX && "we don't support any other mode.");
|
||||||
s_psram_mode = mode;
|
s_psram_mode = mode;
|
||||||
|
|
||||||
putreg32(0x1, SPI_EXT3_REG(0));
|
putreg32(0x1, SPI_EXT3_REG(0));
|
||||||
|
@ -317,7 +317,7 @@ static int rt_timer_thread(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
tmrerr("ERROR: Wait priv->toutsem error=%d\n", ret);
|
tmrerr("ERROR: Wait priv->toutsem error=%d\n", ret);
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = spin_lock_irqsave(&priv->lock);
|
flags = spin_lock_irqsave(&priv->lock);
|
||||||
|
@ -490,7 +490,7 @@ static void esp32_timer_setcallback(struct timer_lowerhalf_s *lower,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
assert(ret == OK);
|
ASSERT(ret == OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -351,7 +351,7 @@ static int rt_timer_thread(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
tmrerr("ERROR: Wait priv->toutsem error=%d\n", ret);
|
tmrerr("ERROR: Wait priv->toutsem error=%d\n", ret);
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
@ -144,7 +144,7 @@ int mmu_map_psram(uint32_t start_paddr, uint32_t end_paddr,
|
|||||||
|
|
||||||
/* should be MMU page aligned */
|
/* should be MMU page aligned */
|
||||||
|
|
||||||
assert((start_paddr % MMU_PAGE_SIZE) == 0);
|
ASSERT((start_paddr % MMU_PAGE_SIZE) == 0);
|
||||||
|
|
||||||
uint32_t start_vaddr = DPORT_CACHE_ADDRESS_LOW;
|
uint32_t start_vaddr = DPORT_CACHE_ADDRESS_LOW;
|
||||||
uint32_t end_vaddr = start_vaddr + map_length;
|
uint32_t end_vaddr = start_vaddr + map_length;
|
||||||
@ -156,7 +156,7 @@ int mmu_map_psram(uint32_t start_paddr, uint32_t end_paddr,
|
|||||||
cache_bus_mask |= (end_vaddr >= DRAM1_ADDRESS_HIGH) ?
|
cache_bus_mask |= (end_vaddr >= DRAM1_ADDRESS_HIGH) ?
|
||||||
EXTMEM_PRO_DCACHE_MASK_DRAM0 : 0;
|
EXTMEM_PRO_DCACHE_MASK_DRAM0 : 0;
|
||||||
|
|
||||||
assert(end_vaddr <= DRAM0_CACHE_ADDRESS_HIGH);
|
ASSERT(end_vaddr <= DRAM0_CACHE_ADDRESS_HIGH);
|
||||||
|
|
||||||
minfo("start_paddr is %x, map_length is %xB, %d pages",
|
minfo("start_paddr is %x, map_length is %xB, %d pages",
|
||||||
start_paddr, map_length, BYTES_TO_MMU_PAGE(map_length));
|
start_paddr, map_length, BYTES_TO_MMU_PAGE(map_length));
|
||||||
|
@ -397,7 +397,7 @@ static void psram_gpio_config(void)
|
|||||||
|
|
||||||
int psram_enable(int mode, int vaddrmode)
|
int psram_enable(int mode, int vaddrmode)
|
||||||
{
|
{
|
||||||
assert(mode < PSRAM_CACHE_MAX && \
|
ASSERT(mode < PSRAM_CACHE_MAX && \
|
||||||
"we don't support any other mode for now.");
|
"we don't support any other mode for now.");
|
||||||
|
|
||||||
psram_gpio_config();
|
psram_gpio_config();
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
/* Custom assert macro - easy to disable */
|
/* Custom assert macro - easy to disable */
|
||||||
|
|
||||||
#define require(p, msg) assert(p && msg)
|
#define require(p, msg) ASSERT(p && msg)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions Prototype
|
* Private Functions Prototype
|
||||||
|
@ -476,7 +476,7 @@ static int usbdev_fs_open(FAR struct file *filep)
|
|||||||
|
|
||||||
fs_ep->crefs += 1;
|
fs_ep->crefs += 1;
|
||||||
|
|
||||||
assert(fs_ep->crefs != 0);
|
ASSERT(fs_ep->crefs != 0);
|
||||||
|
|
||||||
nxmutex_unlock(&fs_ep->lock);
|
nxmutex_unlock(&fs_ep->lock);
|
||||||
return ret;
|
return ret;
|
||||||
@ -510,7 +510,7 @@ static int usbdev_fs_close(FAR struct file *filep)
|
|||||||
|
|
||||||
fs_ep->crefs -= 1;
|
fs_ep->crefs -= 1;
|
||||||
|
|
||||||
assert(fs_ep->crefs >= 0);
|
ASSERT(fs_ep->crefs >= 0);
|
||||||
|
|
||||||
if (fs_ep->unlinked && fs_ep->crefs == 0)
|
if (fs_ep->unlinked && fs_ep->crefs == 0)
|
||||||
{
|
{
|
||||||
|
@ -418,7 +418,7 @@ static reg_errcode_t tre_stack_push(tre_stack_t *s,
|
|||||||
return REG_ESPACE;
|
return REG_ESPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(new_size > s->size);
|
ASSERT(new_size > s->size);
|
||||||
s->size = new_size;
|
s->size = new_size;
|
||||||
s->stack = new_buffer;
|
s->stack = new_buffer;
|
||||||
tre_stack_push(s, value);
|
tre_stack_push(s, value);
|
||||||
@ -1802,7 +1802,7 @@ static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(tnfa->submatch_data[id].parents == NULL);
|
ASSERT(tnfa->submatch_data[id].parents == NULL);
|
||||||
tnfa->submatch_data[id].parents = p;
|
tnfa->submatch_data[id].parents = p;
|
||||||
for (i = 0; parents[i] >= 0; i++)
|
for (i = 0; parents[i] >= 0; i++)
|
||||||
{
|
{
|
||||||
@ -1870,7 +1870,7 @@ static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!IS_TAG(lit));
|
ASSERT(!IS_TAG(lit));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2219,7 +2219,7 @@ static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2250,7 +2250,7 @@ static reg_errcode_t tre_add_tags(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
num_minimals++;
|
num_minimals++;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(tree->num_tags == num_tags);
|
ASSERT(tree->num_tags == num_tags);
|
||||||
tnfa->end_tag = num_tags;
|
tnfa->end_tag = num_tags;
|
||||||
tnfa->num_tags = num_tags;
|
tnfa->num_tags = num_tags;
|
||||||
tnfa->num_minimals = num_minimals;
|
tnfa->num_minimals = num_minimals;
|
||||||
@ -2424,7 +2424,7 @@ static reg_errcode_t tre_copy_ast(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2537,7 +2537,7 @@ static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2684,7 +2684,7 @@ static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2935,7 +2935,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack,
|
|||||||
|
|
||||||
case ASSERTION:
|
case ASSERTION:
|
||||||
{
|
{
|
||||||
assert(lit->code_max >= 1 || lit->code_max <= ASSERT_LAST);
|
ASSERT(lit->code_max >= 1 || lit->code_max <= ASSERT_LAST);
|
||||||
if (assertions != NULL)
|
if (assertions != NULL)
|
||||||
{
|
{
|
||||||
*assertions |= lit->code_max;
|
*assertions |= lit->code_max;
|
||||||
@ -2950,7 +2950,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2970,7 +2970,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack,
|
|||||||
else if (uni->right->nullable)
|
else if (uni->right->nullable)
|
||||||
STACK_PUSHX(stack, voidptr, uni->right)
|
STACK_PUSHX(stack, voidptr, uni->right)
|
||||||
else
|
else
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2979,8 +2979,8 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack,
|
|||||||
/* The path must go through both children. */
|
/* The path must go through both children. */
|
||||||
|
|
||||||
cat = (tre_catenation_t *)node->obj;
|
cat = (tre_catenation_t *)node->obj;
|
||||||
assert(cat->left->nullable);
|
ASSERT(cat->left->nullable);
|
||||||
assert(cat->right->nullable);
|
ASSERT(cat->right->nullable);
|
||||||
STACK_PUSHX(stack, voidptr, cat->left);
|
STACK_PUSHX(stack, voidptr, cat->left);
|
||||||
STACK_PUSHX(stack, voidptr, cat->right);
|
STACK_PUSHX(stack, voidptr, cat->right);
|
||||||
}
|
}
|
||||||
@ -3002,7 +3002,7 @@ static reg_errcode_t tre_match_empty(tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3323,7 +3323,7 @@ static reg_errcode_t tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
assert(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3419,8 +3419,8 @@ static reg_errcode_t tre_make_trans(tre_pos_and_tags_t *p1,
|
|||||||
NULL ? ASSERT_CHAR_CLASS_NEG : 0);
|
NULL ? ASSERT_CHAR_CLASS_NEG : 0);
|
||||||
if (p1->backref >= 0)
|
if (p1->backref >= 0)
|
||||||
{
|
{
|
||||||
assert((trans->assertions & ASSERT_CHAR_CLASS) == 0);
|
ASSERT((trans->assertions & ASSERT_CHAR_CLASS) == 0);
|
||||||
assert(p2->backref < 0);
|
ASSERT(p2->backref < 0);
|
||||||
trans->u.backref = p1->backref;
|
trans->u.backref = p1->backref;
|
||||||
trans->assertions |= ASSERT_BACKREF;
|
trans->assertions |= ASSERT_BACKREF;
|
||||||
}
|
}
|
||||||
@ -3627,11 +3627,11 @@ static reg_errcode_t tre_ast_to_tnfa(tre_ast_node_t *node,
|
|||||||
case ITERATION:
|
case ITERATION:
|
||||||
{
|
{
|
||||||
iter = (tre_iteration_t *)node->obj;
|
iter = (tre_iteration_t *)node->obj;
|
||||||
assert(iter->max == -1 || iter->max == 1);
|
ASSERT(iter->max == -1 || iter->max == 1);
|
||||||
|
|
||||||
if (iter->max == -1)
|
if (iter->max == -1)
|
||||||
{
|
{
|
||||||
assert(iter->min == 0 || iter->min == 1);
|
ASSERT(iter->min == 0 || iter->min == 1);
|
||||||
|
|
||||||
/* Add a transition from each last position in the iterated
|
/* Add a transition from each last position in the iterated
|
||||||
* expression to each first position.
|
* expression to each first position.
|
||||||
|
@ -133,7 +133,7 @@ static int tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assert(0); */
|
/* ASSERT(0); */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@ static reg_errcode_t tre_tnfa_run_parallel(const tre_tnfa_t *tnfa,
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(reach_pos[trans_i->state_id].pos == pos);
|
ASSERT(reach_pos[trans_i->state_id].pos == pos);
|
||||||
|
|
||||||
/* Another path has also reached this state. We choose
|
/* Another path has also reached this state. We choose
|
||||||
* the winner by examining the tag values for both
|
* the winner by examining the tag values for both
|
||||||
@ -681,7 +681,7 @@ typedef struct tre_backtrack_struct *tre_backtrack_t;
|
|||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
int i; \
|
int i; \
|
||||||
assert(stack->prev); \
|
ASSERT(stack->prev); \
|
||||||
pos = stack->item.pos; \
|
pos = stack->item.pos; \
|
||||||
str_byte = stack->item.str_byte; \
|
str_byte = stack->item.str_byte; \
|
||||||
state = stack->item.state; \
|
state = stack->item.state; \
|
||||||
@ -1181,10 +1181,10 @@ static void tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
|
|||||||
{
|
{
|
||||||
if (pmatch[i].rm_eo == -1)
|
if (pmatch[i].rm_eo == -1)
|
||||||
{
|
{
|
||||||
assert(pmatch[i].rm_so == -1);
|
ASSERT(pmatch[i].rm_so == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pmatch[i].rm_so <= pmatch[i].rm_eo);
|
ASSERT(pmatch[i].rm_so <= pmatch[i].rm_eo);
|
||||||
|
|
||||||
parents = submatch_data[i].parents;
|
parents = submatch_data[i].parents;
|
||||||
if (parents != NULL)
|
if (parents != NULL)
|
||||||
|
@ -44,18 +44,18 @@ static void checkcorruption_handler(FAR struct mm_allocnode_s *node,
|
|||||||
|
|
||||||
if (MM_NODE_IS_ALLOC(node))
|
if (MM_NODE_IS_ALLOC(node))
|
||||||
{
|
{
|
||||||
assert(nodesize >= MM_SIZEOF_ALLOCNODE);
|
ASSERT(nodesize >= MM_SIZEOF_ALLOCNODE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR struct mm_freenode_s *fnode = (FAR void *)node;
|
FAR struct mm_freenode_s *fnode = (FAR void *)node;
|
||||||
|
|
||||||
assert(nodesize >= MM_MIN_CHUNK);
|
ASSERT(nodesize >= MM_MIN_CHUNK);
|
||||||
assert(fnode->blink->flink == fnode);
|
ASSERT(fnode->blink->flink == fnode);
|
||||||
assert(MM_SIZEOF_NODE(fnode->blink) <= nodesize);
|
ASSERT(MM_SIZEOF_NODE(fnode->blink) <= nodesize);
|
||||||
assert(fnode->flink == NULL ||
|
ASSERT(fnode->flink == NULL ||
|
||||||
fnode->flink->blink == fnode);
|
fnode->flink->blink == fnode);
|
||||||
assert(fnode->flink == NULL ||
|
ASSERT(fnode->flink == NULL ||
|
||||||
MM_SIZEOF_NODE(fnode->flink) == 0 ||
|
MM_SIZEOF_NODE(fnode->flink) == 0 ||
|
||||||
MM_SIZEOF_NODE(fnode->flink) >= nodesize);
|
MM_SIZEOF_NODE(fnode->flink) >= nodesize);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ ip_fragout_allocfragbuf(FAR struct iob_queue_s *fragq);
|
|||||||
|
|
||||||
static void ip_fragin_timerout_expiry(wdparm_t arg)
|
static void ip_fragin_timerout_expiry(wdparm_t arg)
|
||||||
{
|
{
|
||||||
assert(g_wkfragtimeout.worker == NULL);
|
ASSERT(g_wkfragtimeout.worker == NULL);
|
||||||
work_queue(IPFRAGWORK, &g_wkfragtimeout, ip_fragin_timerwork, NULL, 0);
|
work_queue(IPFRAGWORK, &g_wkfragtimeout, ip_fragin_timerwork, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ ip_fragout_allocfragbuf(FAR struct iob_queue_s *fragq)
|
|||||||
uint32_t ip_frag_remnode(FAR struct ip_fragsnode_s *node)
|
uint32_t ip_frag_remnode(FAR struct ip_fragsnode_s *node)
|
||||||
{
|
{
|
||||||
g_bufoccupy -= node->bufcnt;
|
g_bufoccupy -= node->bufcnt;
|
||||||
assert(g_bufoccupy < CONFIG_IOB_NBUFFERS);
|
ASSERT(g_bufoccupy < CONFIG_IOB_NBUFFERS);
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)node, &g_assemblyhead_ipid);
|
sq_rem((FAR sq_entry_t *)node, &g_assemblyhead_ipid);
|
||||||
sq_rem((FAR sq_entry_t *)&node->flinkat, &g_assemblyhead_time);
|
sq_rem((FAR sq_entry_t *)&node->flinkat, &g_assemblyhead_time);
|
||||||
@ -799,7 +799,7 @@ int32_t ip_fragout_slice(FAR struct iob_s *iob, uint8_t domain, uint16_t mtu,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(iob->io_pktlen > mtu);
|
ASSERT(iob->io_pktlen > mtu);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
if (domain == PF_INET)
|
if (domain == PF_INET)
|
||||||
|
@ -378,7 +378,7 @@ int32_t ipv4_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
nfrags = ip_fragout_slice(dev->d_iob, PF_INET, mtu, hdrlen, &fragq);
|
nfrags = ip_fragout_slice(dev->d_iob, PF_INET, mtu, hdrlen, &fragq);
|
||||||
assert(nfrags > 1);
|
ASSERT(nfrags > 1);
|
||||||
netdev_iob_clear(dev);
|
netdev_iob_clear(dev);
|
||||||
|
|
||||||
/* Fill the L3 header into the reserved space */
|
/* Fill the L3 header into the reserved space */
|
||||||
|
@ -588,7 +588,7 @@ int32_t ipv6_fragout(FAR struct net_driver_s *dev, uint16_t mtu)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
nfrags = ip_fragout_slice(dev->d_iob, PF_INET6, mtu, unfraglen, &fragq);
|
nfrags = ip_fragout_slice(dev->d_iob, PF_INET6, mtu, unfraglen, &fragq);
|
||||||
assert(nfrags > 1);
|
ASSERT(nfrags > 1);
|
||||||
netdev_iob_clear(dev);
|
netdev_iob_clear(dev);
|
||||||
|
|
||||||
ipid = ++g_ipv6id;
|
ipid = ++g_ipv6id;
|
||||||
|
Loading…
Reference in New Issue
Block a user