Skip to content

Commit cb39a9b

Browse files
committed
compiler: add HAVE_EXPRESSION_STATEMENT macro for gcc
this will open fast version of div_const which defined in: include/nuttx/lib/math32.h when meet 64/32 when use gcc compiling Signed-off-by: ligd <[email protected]>
1 parent 38fbb4e commit cb39a9b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

arch/risc-v/src/esp32c3-legacy/esp32c3_ble_adapter.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
913913
{
914914
int ret;
915915
struct bt_sem_s *bt_sem = (struct bt_sem_s *)semphr;
916+
uint32_t tick = MSEC2TICK(block_time_ms);
916917

917918
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING)
918919
{
@@ -922,7 +923,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
922923
{
923924
if (block_time_ms > 0)
924925
{
925-
ret = nxsem_tickwait(&bt_sem->sem, MSEC2TICK(block_time_ms));
926+
ret = nxsem_tickwait(&bt_sem->sem, tick);
926927
}
927928
else
928929
{
@@ -932,8 +933,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
932933

933934
if (ret)
934935
{
935-
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n",
936-
MSEC2TICK(block_time_ms), ret);
936+
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n", tick, ret);
937937
}
938938

939939
return esp_errno_trans(ret);

include/nuttx/compiler.h

+6
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,12 @@
559559
# define tz_nonsecure_call __attribute__((cmse_nonsecure_call))
560560
# endif
561561

562+
/* GCC support expression statement, a compound statement enclosed in
563+
* parentheses may appear as an expression in GNU C.
564+
*/
565+
566+
# define CONFIG_HAVE_EXPRESSION_STATEMENT 1
567+
562568
/* SDCC-specific definitions ************************************************/
563569

564570
#elif defined(SDCC) || defined(__SDCC)

0 commit comments

Comments
 (0)