Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: add HAVE_EXPRESSION_STATEMENT macro for gcc #14580

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions arch/risc-v/src/esp32c3-legacy/esp32c3_ble_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
int ret;
struct bt_sem_s *bt_sem = (struct bt_sem_s *)semphr;
uint32_t tick = MSEC2TICK(block_time_ms);

if (block_time_ms == OSI_FUNCS_TIME_BLOCKING)
{
Expand All @@ -922,7 +923,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
if (block_time_ms > 0)
{
ret = nxsem_tickwait(&bt_sem->sem, MSEC2TICK(block_time_ms));
ret = nxsem_tickwait(&bt_sem->sem, tick);
}
else
{
Expand All @@ -932,8 +933,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)

if (ret)
{
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n",
MSEC2TICK(block_time_ms), ret);
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n", tick, ret);
}

return esp_errno_trans(ret);
Expand Down
6 changes: 3 additions & 3 deletions arch/risc-v/src/esp32c3/esp_ble_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
int ret;
struct bt_sem_s *bt_sem = (struct bt_sem_s *)semphr;
uint32_t tick = MSEC2TICK(block_time_ms);

if (block_time_ms == OSI_FUNCS_TIME_BLOCKING)
{
Expand All @@ -1061,7 +1062,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
if (block_time_ms > 0)
{
ret = nxsem_tickwait(&bt_sem->sem, MSEC2TICK(block_time_ms));
ret = nxsem_tickwait(&bt_sem->sem, tick);
}
else
{
Expand All @@ -1071,8 +1072,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)

if (ret)
{
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n",
MSEC2TICK(block_time_ms), ret);
wlerr("ERROR: Failed to wait sem in %lu ticks. Error=%d\n", tick, ret);
}

return esp_errno_trans(ret);
Expand Down
6 changes: 3 additions & 3 deletions arch/xtensa/src/esp32/esp32_ble_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
int ret;
struct bt_sem_s *bt_sem = (struct bt_sem_s *)semphr;
uint32_t tick = MSEC2TICK(block_time_ms);

if (block_time_ms == OSI_FUNCS_TIME_BLOCKING)
{
Expand All @@ -1124,7 +1125,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
if (block_time_ms > 0)
{
ret = nxsem_tickwait(&bt_sem->sem, MSEC2TICK(block_time_ms));
ret = nxsem_tickwait(&bt_sem->sem, tick);
}
else
{
Expand All @@ -1134,8 +1135,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)

if (ret)
{
wlerr("ERROR: Failed to wait sem in %u ticks. Error=%d\n",
MSEC2TICK(block_time_ms), ret);
wlerr("ERROR: Failed to wait sem in %u ticks. Error=%d\n", tick, ret);
}

return esp_errno_trans(ret);
Expand Down
6 changes: 3 additions & 3 deletions arch/xtensa/src/esp32s3/esp32s3_ble_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
int ret;
struct bt_sem_s *bt_sem = (struct bt_sem_s *)semphr;
uint32_t tick = MSEC2TICK(block_time_ms);

if (block_time_ms == OSI_FUNCS_TIME_BLOCKING)
{
Expand All @@ -1052,7 +1053,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
{
if (block_time_ms > 0)
{
ret = nxsem_tickwait(&bt_sem->sem, MSEC2TICK(block_time_ms));
ret = nxsem_tickwait(&bt_sem->sem, tick);
}
else
{
Expand All @@ -1062,8 +1063,7 @@ static int semphr_take_wrapper(void *semphr, uint32_t block_time_ms)

if (ret)
{
wlerr("ERROR: Failed to wait sem in %u ticks. Error=%d\n",
MSEC2TICK(block_time_ms), ret);
wlerr("ERROR: Failed to wait sem in %u ticks. Error=%d\n", tick, ret);
}

return esp_errno_trans(ret);
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/cxd56xx/spresense/src/cxd56_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ static const struct cxd56_automount_config_s g_sdcard0config =
.fstype = CONFIG_CXD56_SDCARD_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_CXD56_SDCARD_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_CXD56_SDCARD_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_CXD56_SDCARD_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_CXD56_SDCARD_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICK_SLOW(CONFIG_CXD56_SDCARD_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK_SLOW(CONFIG_CXD56_SDCARD_AUTOMOUNT_UDELAY),
.attach = sdcard_attach,
.enable = sdcard_enable,
.inserted = sdcard_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/kinetis/freedom-k28f/src/k28_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ static const struct k28_automount_config_s g_sdhc_config =
.fstype = CONFIG_FRDMK28F_SDHC_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_FRDMK28F_SDHC_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_FRDMK28F_SDHC_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_FRDMK28F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_FRDMK28F_SDHC_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_FRDMK28F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_FRDMK28F_SDHC_AUTOMOUNT_UDELAY),
.attach = k28_sdhc_attach,
.enable = k28_sdhc_enable,
.inserted = k28_sdhc_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/kinetis/freedom-k64f/src/k64_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ static const struct k64_automount_config_s g_sdhc_config =
.fstype = CONFIG_FRDMK64F_SDHC_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_FRDMK64F_SDHC_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_FRDMK64F_SDHC_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_FRDMK64F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_FRDMK64F_SDHC_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_FRDMK64F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_FRDMK64F_SDHC_AUTOMOUNT_UDELAY),
.attach = k64_attach,
.enable = k64_enable,
.inserted = k64_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/kinetis/freedom-k66f/src/k66_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ static const struct k66_automount_config_s g_sdhc_config =
.fstype = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY),
.attach = k66_attach,
.enable = k66_enable,
.inserted = k66_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/kinetis/twr-k64f120m/src/k64_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ static const struct k64_automount_config_s g_sdhc_config =
.fstype = CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_TWR_K64F120M_SDHC_AUTOMOUNT_UDELAY),
.attach = k64_attach,
.enable = k64_enable,
.inserted = k64_inserted
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/sama5/sama5d4-ek/src/sam_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ static const struct sam_automount_config_s g_hsmci0config =
.fstype = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
Expand All @@ -109,8 +109,8 @@ static const struct sam_automount_config_s g_hsmci1config =
.fstype = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICK_SLOW(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK_SLOW(CONFIG_SAMA5D4EK_HSMCI1_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/samd5e5/metro-m4/src/sam_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ static const struct sam_automount_config_s g_port0config =
.fstype = CONFIG_METRO_M4_USB_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_METRO_M4_USB_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_METRO_M4_USB_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_METRO_M4_USB_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_METRO_M4_USB_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICKSLOW(CONFIG_METRO_M4_USB_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICKSLOW(CONFIG_METRO_M4_USB_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/samv7/common/src/sam_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ static const struct sam_automount_config_s g_hsmci0config =
.fstype = CONFIG_SAMV7_HSMCI0_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_SAMV7_HSMCI0_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_SAMV7_HSMCI0_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(CONFIG_SAMV7_HSMCI0_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(CONFIG_SAMV7_HSMCI0_AUTOMOUNT_UDELAY),
.ddelay = MSEC2TICK_SLOW(CONFIG_SAMV7_HSMCI0_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK_SLOW(CONFIG_SAMV7_HSMCI0_AUTOMOUNT_UDELAY),
.attach = sam_attach,
.enable = sam_enable,
.inserted = sam_inserted
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/stm32/clicker2-stm32/src/stm32_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ static const struct stm32_automount_config_s g_mb1_mmcsdconfig =
.fstype = CONFIG_CLICKER2_STM32_MB1_MMCSD_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_CLICKER2_STM32_MB1_MMCSD_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_CLICKER2_STM32_MB1_MMCSD_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(
.ddelay = MSEC2TICKSLOW(
CONFIG_CLICKER2_STM32_MB1_MMCSD_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(
.udelay = MSEC2TICKSLOW(
CONFIG_CLICKER2_STM32_MB1_MMCSD_AUTOMOUNT_UDELAY),
.attach = stm32_attach,
.enable = stm32_enable,
Expand All @@ -115,9 +115,9 @@ static const struct stm32_automount_config_s g_mb2_mmcsdconfig =
.fstype = CONFIG_CLICKER2_STM32_MB2_MMCSD_AUTOMOUNT_FSTYPE,
.blockdev = CONFIG_CLICKER2_STM32_MB2_MMCSD_AUTOMOUNT_BLKDEV,
.mountpoint = CONFIG_CLICKER2_STM32_MB2_MMCSD_AUTOMOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(
.ddelay = MSEC2TICKSLOW(
CONFIG_CLICKER2_STM32_MB2_MMCSD_AUTOMOUNT_DDELAY),
.udelay = MSEC2TICK(
.udelay = MSEC2TICKSLOW(
CONFIG_CLICKER2_STM32_MB2_MMCSD_AUTOMOUNT_UDELAY),
.attach = stm32_attach,
.enable = stm32_enable,
Expand Down
6 changes: 2 additions & 4 deletions boards/risc-v/litex/arty_a7/src/litex_automount.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ static const struct litex_automount_config_s g_mb1_mmcsdconfig =
.fstype = CONFIG_LITEX_SDIO_MOUNT_FSTYPE,
.blockdev = CONFIG_LITEX_SDIO_MOUNT_BLKDEV,
.mountpoint = CONFIG_LITEX_SDIO_MOUNT_MOUNTPOINT,
.ddelay = MSEC2TICK(
100),
.udelay = MSEC2TICK(
100),
.ddelay = MSEC2TICKSLOW(100),
.udelay = MSEC2TICKSLOW(100),
.attach = litex_attach,
.enable = litex_enable,
.inserted = litex_inserted
Expand Down
2 changes: 2 additions & 0 deletions include/nuttx/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@

#if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK
# define MSEC2TICK(msec) div_const_roundup(msec, MSEC_PER_TICK)
# define MSEC2TICKSLOW(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need slow version

#else
# define MSEC2TICK(msec) USEC2TICK((msec) * USEC_PER_MSEC)
# define MSEC2TICKSLOW(msec) USEC2TICK((msec) * USEC_PER_MSEC)
#endif

#define DSEC2TICK(dsec) MSEC2TICK((dsec) * MSEC_PER_DSEC)
Expand Down
6 changes: 6 additions & 0 deletions include/nuttx/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,12 @@
# define tz_nonsecure_call __attribute__((cmse_nonsecure_call))
# endif

/* GCC support expression statement, a compound statement enclosed in
* parentheses may appear as an expression in GNU C.
*/

# define CONFIG_HAVE_EXPRESSION_STATEMENT 1

/* SDCC-specific definitions ************************************************/

#elif defined(SDCC) || defined(__SDCC)
Expand Down
Loading