From 47ae656cc1b9e18216a6c0e510ba3e3a37898aee Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Mon, 28 Feb 2022 14:06:36 +0100 Subject: [PATCH] all: Deprecate UTIL_LISTIFY and replace with LISTIFY UTIL_LISTIFY is deprecated. Replacing it with LISTIFY. Signed-off-by: Krzysztof Chruscinski --- arch/common/sw_isr_common.c | 6 +- drivers/adc/adc_mcp320x.c | 8 +-- drivers/console/uart_mux.c | 16 +++--- drivers/dac/dac_dacx0508.c | 4 +- drivers/dac/dac_dacx3608.c | 4 +- drivers/display/display_ili9xxx.c | 4 +- drivers/display/display_nrf_led_matrix.c | 4 +- drivers/dma/dmamux_stm32.c | 30 +++++----- drivers/eeprom/eeprom_at2x.c | 4 +- drivers/ethernet/eth_native_posix.c | 22 ++++---- drivers/flash/flash_simulator.c | 10 ++-- drivers/ipm/ipm_nrfx_ipc.c | 4 +- drivers/lora/sx127x.c | 4 +- include/bluetooth/gatt.h | 11 ++-- include/bluetooth/mesh/access.h | 14 ++--- include/drivers/pinctrl.h | 12 ++-- include/pm/state.h | 12 ++-- include/sys/util_macro.h | 4 +- soc/arm/atmel_sam/common/atmel_sam_dt.h | 6 +- soc/arm/atmel_sam0/common/atmel_sam0_dt.h | 6 +- soc/arm/cypress/common/cypress_psoc6_dt.h | 6 +- soc/arm/nuvoton_npcx/common/soc_dt.h | 56 +++++++++---------- soc/arm/st_stm32/common/st_stm32_dt.h | 20 +++---- soc/riscv/riscv-ite/common/soc_dt.h | 10 ++-- subsys/bluetooth/audio/mics.c | 2 +- subsys/bluetooth/audio/vcs.c | 4 +- subsys/bluetooth/controller/ll_sw/lll.h | 4 +- subsys/modbus/modbus_core.c | 4 +- subsys/net/ip/net_tc.c | 8 +-- subsys/net/l2/virtual/ipip/ipip.c | 8 +-- subsys/net/lib/capture/capture.c | 8 +-- subsys/pm/pm.c | 4 +- subsys/pm/state.c | 6 +- subsys/testsuite/ztest/src/ztress.c | 4 +- subsys/usb/class/audio/audio.c | 6 +- subsys/usb/class/hid/core.c | 24 ++++---- .../bsim_test_gatt/src/gatt_client_test.c | 6 +- .../counter_basic_api/src/test_counter.c | 6 +- tests/lib/devicetree/api/src/main.c | 18 +++--- tests/subsys/logging/log_benchmark/src/main.c | 12 ++-- .../usb/desc_sections/src/desc_sections.c | 12 ++-- tests/unit/util/test.inc | 25 --------- 42 files changed, 206 insertions(+), 232 deletions(-) diff --git a/arch/common/sw_isr_common.c b/arch/common/sw_isr_common.c index 10ac58ea06..9e87b8bf7a 100644 --- a/arch/common/sw_isr_common.c +++ b/arch/common/sw_isr_common.c @@ -23,7 +23,7 @@ struct irq_parent_offset { #define INIT_IRQ_PARENT_OFFSET(i, o) { \ .irq = i, \ .offset = o, \ -}, +} #define IRQ_INDEX_TO_OFFSET(i, base) (base + i * CONFIG_MAX_IRQ_PER_AGGREGATOR) @@ -33,7 +33,7 @@ struct irq_parent_offset { INIT_IRQ_PARENT_OFFSET(CONFIG_2ND_LVL_INTR_0##i##_OFFSET, \ IRQ_INDEX_TO_OFFSET(i, base)) static struct irq_parent_offset lvl2_irq_list[CONFIG_NUM_2ND_LEVEL_AGGREGATORS] - = { UTIL_LISTIFY(CONFIG_NUM_2ND_LEVEL_AGGREGATORS, CAT_2ND_LVL_LIST, + = { LISTIFY(CONFIG_NUM_2ND_LEVEL_AGGREGATORS, CAT_2ND_LVL_LIST, (,), CONFIG_2ND_LVL_ISR_TBL_OFFSET) }; #endif/* CONFIG_2ND_LEVEL_INTERRUPTS */ @@ -44,7 +44,7 @@ static struct irq_parent_offset lvl2_irq_list[CONFIG_NUM_2ND_LEVEL_AGGREGATORS] INIT_IRQ_PARENT_OFFSET(CONFIG_3RD_LVL_INTR_0##i##_OFFSET, \ IRQ_INDEX_TO_OFFSET(i, base)) static struct irq_parent_offset lvl3_irq_list[CONFIG_NUM_3RD_LEVEL_AGGREGATORS] - = { UTIL_LISTIFY(CONFIG_NUM_3RD_LEVEL_AGGREGATORS, CAT_3RD_LVL_LIST, + = { LISTIFY(CONFIG_NUM_3RD_LEVEL_AGGREGATORS, CAT_3RD_LVL_LIST, (,), CONFIG_3RD_LVL_ISR_TBL_OFFSET) }; #endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ diff --git a/drivers/adc/adc_mcp320x.c b/drivers/adc/adc_mcp320x.c index dd912aa573..eeb8b856e0 100644 --- a/drivers/adc/adc_mcp320x.c +++ b/drivers/adc/adc_mcp320x.c @@ -331,11 +331,11 @@ static const struct adc_driver_api mcp320x_adc_api = { */ #define MCP3208_DEVICE(n) MCP320X_DEVICE(3208, n, 8) -#define CALL_WITH_ARG(arg, expr) expr(arg); +#define CALL_WITH_ARG(arg, expr) expr(arg) -#define INST_DT_MCP320X_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \ - CALL_WITH_ARG, inst_expr) +#define INST_DT_MCP320X_FOREACH(t, inst_expr) \ + LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \ + CALL_WITH_ARG, (;), inst_expr) INST_DT_MCP320X_FOREACH(3204, MCP3204_DEVICE); INST_DT_MCP320X_FOREACH(3208, MCP3208_DEVICE); diff --git a/drivers/console/uart_mux.c b/drivers/console/uart_mux.c index 55a8ba7bad..89d7517bf6 100644 --- a/drivers/console/uart_mux.c +++ b/drivers/console/uart_mux.c @@ -69,9 +69,9 @@ struct uart_mux { static struct uart_mux uart_mux_##x __used \ __attribute__((__section__(".uart_mux.data"))) = { \ .rx_ringbuf = &uart_rx_ringbuf_##x, \ - }; + } -UTIL_LISTIFY(CONFIG_UART_MUX_REAL_DEVICE_COUNT, DEFINE_UART_MUX, _) +LISTIFY(CONFIG_UART_MUX_REAL_DEVICE_COUNT, DEFINE_UART_MUX, (;), _) extern struct uart_mux __uart_mux_start[]; extern struct uart_mux __uart_mux_end[]; @@ -869,7 +869,7 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data) #define DEFINE_UART_MUX_CFG_DATA(x, _) \ struct uart_mux_cfg_data uart_mux_config_##x = { \ - }; + } #define DEFINE_UART_MUX_DEV_DATA(x, _) \ RING_BUF_DECLARE(tx_ringbuf_##x, CONFIG_UART_MUX_RINGBUF_SIZE); \ @@ -877,7 +877,7 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data) static struct uart_mux_dev_data uart_mux_dev_data_##x = { \ .tx_ringbuf = &tx_ringbuf_##x, \ .rx_ringbuf = &rx_ringbuf_##x, \ - }; + } #define DEFINE_UART_MUX_DEVICE(x, _) \ DEVICE_DEFINE(uart_mux_##x, \ @@ -888,11 +888,11 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data) &uart_mux_config_##x, \ POST_KERNEL, \ CONFIG_CONSOLE_INIT_PRIORITY, \ - &uart_mux_driver_api); + &uart_mux_driver_api) -UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, _) -UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEV_DATA, _) -UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEVICE, _) +LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, (;), _) +LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEV_DATA, (;), _) +LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEVICE, (;), _) static int init_uart_mux(const struct device *dev) { diff --git a/drivers/dac/dac_dacx0508.c b/drivers/dac/dac_dacx0508.c index 79f88743f1..2b05ccccad 100644 --- a/drivers/dac/dac_dacx0508.c +++ b/drivers/dac/dac_dacx0508.c @@ -406,8 +406,8 @@ static const struct dac_driver_api dacx0508_driver_api = { #define CALL_WITH_ARG(arg, expr) expr(arg) #define INST_DT_DACX0508_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \ - CALL_WITH_ARG, inst_expr) + LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \ + CALL_WITH_ARG, (), inst_expr) INST_DT_DACX0508_FOREACH(60508, DAC60508_DEVICE); INST_DT_DACX0508_FOREACH(70508, DAC70508_DEVICE); diff --git a/drivers/dac/dac_dacx3608.c b/drivers/dac/dac_dacx3608.c index 45f476420b..781b4f2f72 100644 --- a/drivers/dac/dac_dacx3608.c +++ b/drivers/dac/dac_dacx3608.c @@ -267,8 +267,8 @@ static const struct dac_driver_api dacx3608_driver_api = { #define CALL_WITH_ARG(arg, expr) expr(arg) #define INST_DT_DACX3608_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \ - CALL_WITH_ARG, inst_expr) + LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \ + CALL_WITH_ARG, (), inst_expr) INST_DT_DACX3608_FOREACH(43608, DAC43608_DEVICE); INST_DT_DACX3608_FOREACH(53608, DAC53608_DEVICE); diff --git a/drivers/display/display_ili9xxx.c b/drivers/display/display_ili9xxx.c index 3af90c9d89..387bbbdd5a 100644 --- a/drivers/display/display_ili9xxx.c +++ b/drivers/display/display_ili9xxx.c @@ -447,10 +447,10 @@ static const struct display_driver_api ili9xxx_api = { DEVICE_DT_DEFINE(INST_DT_ILI9XXX(n, t), ili9xxx_init, \ NULL, &ili9xxx_data_##n, \ &ili9xxx_config_##n, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api); + CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api) #define DT_INST_FOREACH_ILI9XXX_STATUS_OKAY(t) \ - UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, t) + LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, (;), t) #ifdef CONFIG_ILI9340 #include "display_ili9340.h" diff --git a/drivers/display/display_nrf_led_matrix.c b/drivers/display/display_nrf_led_matrix.c index 52b6dc4f70..3d4e4a7f96 100644 --- a/drivers/display/display_nrf_led_matrix.c +++ b/drivers/display/display_nrf_led_matrix.c @@ -535,8 +535,8 @@ static struct display_drv_data instance_data = { ((DT_GPIO_FLAGS_BY_IDX(node_id, pha, idx) & GPIO_ACTIVE_LOW) ? \ ACTIVE_LOW_MASK : 0)), -#define ADD_FF(i, _) 0xFF, -#define FILL_ROW_WITH_FF(node_id, pha, idx) UTIL_LISTIFY(COL_COUNT, ADD_FF) +#define ADD_FF(i, _) 0xFF +#define FILL_ROW_WITH_FF(node_id, pha, idx) LISTIFY(COL_COUNT, ADD_FF, (,)), #define GET_PIXEL_ORDINAL(node_id, pha, idx) \ [GET_DT_ROW_IDX(idx) * COL_COUNT + \ GET_DT_COL_IDX(idx)] = idx, diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index e969eb63bd..3087d0d743 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -53,33 +53,33 @@ struct dmamux_stm32_config { }; /* - * UTIL_LISTIFY is used to generate arrays with function pointers to check + * LISTIFY is used to generate arrays with function pointers to check * and clear interrupt flags using LL functions */ -#define DMAMUX_CHANNEL(i, _) LL_DMAMUX_CHANNEL_ ## i, -#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i, -#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i, -#define IS_ACTIVE_FLAG_RGOX(i, _) LL_DMAMUX_IsActiveFlag_RGO ## i, -#define CLEAR_FLAG_RGOX(i, _) LL_DMAMUX_ClearFlag_RGO ## i, +#define DMAMUX_CHANNEL(i, _) LL_DMAMUX_CHANNEL_ ## i +#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i +#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i +#define IS_ACTIVE_FLAG_RGOX(i, _) LL_DMAMUX_IsActiveFlag_RGO ## i +#define CLEAR_FLAG_RGOX(i, _) LL_DMAMUX_ClearFlag_RGO ## i uint32_t table_ll_channel[] = { - UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL) + LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL, (,)) }; uint32_t (*func_ll_is_active_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = { - UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX) + LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX, (,)) }; void (*func_ll_clear_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = { - UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX) + LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX, (,)) }; uint32_t (*func_ll_is_active_rgo[])(DMAMUX_Channel_TypeDef *DMAMUXx) = { - UTIL_LISTIFY(DT_INST_PROP(0, dma_generators), IS_ACTIVE_FLAG_RGOX) + LISTIFY(DT_INST_PROP(0, dma_generators), IS_ACTIVE_FLAG_RGOX, (,)) }; void (*func_ll_clear_rgo[])(DMAMUX_Channel_TypeDef *DMAMUXx) = { - UTIL_LISTIFY(DT_INST_PROP(0, dma_generators), CLEAR_FLAG_RGOX) + LISTIFY(DT_INST_PROP(0, dma_generators), CLEAR_FLAG_RGOX, (,)) }; int dmamux_stm32_configure(const struct device *dev, uint32_t id, @@ -279,14 +279,14 @@ static const struct dma_driver_api dma_funcs = { * future extension. */ #define INIT_DMAMUX_0_CHANNEL(x, ...) \ - { .dev_dma = DEV_DMA_BINDING(x), .dma_id = DMA_CHANNEL(x), }, + { .dev_dma = DEV_DMA_BINDING(x), .dma_id = DMA_CHANNEL(x), } #define INIT_DMAMUX_1_CHANNEL(x, ...) \ - { .dev_dma = 0, .dma_id = 0, }, + { .dev_dma = 0, .dma_id = 0, } #define DMAMUX_CHANNELS_INIT_0(count) \ - UTIL_LISTIFY(count, INIT_DMAMUX_0_CHANNEL) + LISTIFY(count, INIT_DMAMUX_0_CHANNEL, (,)) #define DMAMUX_CHANNELS_INIT_1(count) \ - UTIL_LISTIFY(count, INIT_DMAMUX_1_CHANNEL) + LISTIFY(count, INIT_DMAMUX_1_CHANNEL, (,)) #define DMAMUX_CLOCK_INIT(index) \ diff --git a/drivers/eeprom/eeprom_at2x.c b/drivers/eeprom/eeprom_at2x.c index 27a64c0105..886febee84 100644 --- a/drivers/eeprom/eeprom_at2x.c +++ b/drivers/eeprom/eeprom_at2x.c @@ -660,8 +660,8 @@ static const struct eeprom_driver_api eeprom_at2x_api = { #define CALL_WITH_ARG(arg, expr) expr(arg); #define INST_DT_AT2X_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \ - CALL_WITH_ARG, inst_expr) + LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \ + CALL_WITH_ARG, (), inst_expr) #ifdef CONFIG_EEPROM_AT24 INST_DT_AT2X_FOREACH(24, EEPROM_AT24_DEVICE); diff --git a/drivers/ethernet/eth_native_posix.c b/drivers/ethernet/eth_native_posix.c index 204bf4d6ed..200a91d237 100644 --- a/drivers/ethernet/eth_native_posix.c +++ b/drivers/ethernet/eth_native_posix.c @@ -71,9 +71,9 @@ struct eth_context { #define DEFINE_RX_THREAD(x, _) \ K_KERNEL_STACK_DEFINE(rx_thread_stack_##x, \ CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE);\ - static struct k_thread rx_thread_data_##x; + static struct k_thread rx_thread_data_##x -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_RX_THREAD, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_RX_THREAD, (;), _); #if defined(CONFIG_NET_GPTP) static bool need_timestamping(struct gptp_hdr *hdr) @@ -632,9 +632,9 @@ static const struct ethernet_api eth_if_api = { .rx_thread = &rx_thread_data_##x, \ .rx_stack = rx_thread_stack_##x, \ .rx_stack_size = K_KERNEL_STACK_SIZEOF(rx_thread_stack_##x), \ - }; + } -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, (;), _); #define DEFINE_ETH_DEVICE(x, _) \ ETH_NET_DEVICE_INIT(eth_native_posix_##x, \ @@ -644,9 +644,9 @@ UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, _) NULL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ ð_if_api, \ - NET_ETH_MTU); + NET_ETH_MTU) -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEVICE, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEVICE, (;), _); #if defined(CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK) @@ -661,9 +661,9 @@ struct ptp_context { }; #define DEFINE_PTP_DEV_DATA(x, _) \ - static struct ptp_context ptp_context_##x; + static struct ptp_context ptp_context_##x -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEV_DATA, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEV_DATA, (;), _); static int ptp_clock_set_native_posix(const struct device *clk, struct net_ptp_time *tm) @@ -732,7 +732,7 @@ static const struct ptp_clock_driver_api api = { return 0; \ } -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, (), _) #define DEFINE_PTP_DEVICE(x, _) \ DEVICE_DEFINE(eth_native_posix_ptp_clock_##x, \ @@ -743,8 +743,8 @@ UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, _) NULL, \ POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &api); + &api) -UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEVICE, _) +LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEVICE, (;), _); #endif /* CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK */ diff --git a/drivers/flash/flash_simulator.c b/drivers/flash/flash_simulator.c index 742b914caa..cf7200cc5f 100644 --- a/drivers/flash/flash_simulator.c +++ b/drivers/flash/flash_simulator.c @@ -72,7 +72,7 @@ } while (0) #if (CONFIG_FLASH_SIMULATOR_STAT_PAGE_COUNT > STATS_PAGE_COUNT_THRESHOLD) - /* Limitation above is caused by used UTIL_REPEAT */ + /* Limitation above is caused by used LISTIFY */ /* Using FLASH_SIMULATOR_FLASH_PAGE_COUNT allows to avoid terrible */ /* error logg at the output and work with the stats module partially */ #define FLASH_SIMULATOR_FLASH_PAGE_COUNT STATS_PAGE_COUNT_THRESHOLD @@ -93,9 +93,9 @@ STATS_SECT_ENTRY32(flash_erase_calls) /* calls to flash_erase() */ STATS_SECT_ENTRY32(flash_erase_time_us) /* time spent in flash_erase() */ /* -- per-unit statistics -- */ /* erase cycle count for unit */ -UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_EC)) +LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_EC, ()) /* number of read operations on worn out erase units */ -UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_DIRTYR)) +LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_DIRTYR, ()) STATS_SECT_END; STATS_SECT_DECL(flash_sim_stats) flash_sim_stats; @@ -109,8 +109,8 @@ STATS_NAME(flash_sim_stats, flash_write_calls) STATS_NAME(flash_sim_stats, flash_write_time_us) STATS_NAME(flash_sim_stats, flash_erase_calls) STATS_NAME(flash_sim_stats, flash_erase_time_us) -UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_EC)) -UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_DIRTYR)) +LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_EC, ()) +LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_DIRTYR, ()) STATS_NAME_END(flash_sim_stats); /* simulator dynamic thresholds */ diff --git a/drivers/ipm/ipm_nrfx_ipc.c b/drivers/ipm/ipm_nrfx_ipc.c index b3143f9898..6a9e4db7b1 100644 --- a/drivers/ipm/ipm_nrfx_ipc.c +++ b/drivers/ipm/ipm_nrfx_ipc.c @@ -231,9 +231,9 @@ DEVICE_DEFINE(vipm_nrf_##_idx, "IPM_"#_idx, \ &vipm_nrf_##_idx##_driver_api) #define VIPM_DEVICE(_idx, _) \ - IF_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_ENABLE, (VIPM_DEVICE_1(_idx);)) + IF_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_ENABLE, (VIPM_DEVICE_1(_idx))) -UTIL_LISTIFY(NRFX_IPC_ID_MAX_VALUE, VIPM_DEVICE, _); +LISTIFY(NRFX_IPC_ID_MAX_VALUE, VIPM_DEVICE, (;), _); #endif diff --git a/drivers/lora/sx127x.c b/drivers/lora/sx127x.c index 222f4b6d5b..0f6e4d29de 100644 --- a/drivers/lora/sx127x.c +++ b/drivers/lora/sx127x.c @@ -145,10 +145,10 @@ extern DioIrqHandler *DioIrq[]; DT_INST_PROP_LEN(inst, dio_gpios) #define SX127X_DIO_GPIO_ELEM(idx, inst) \ - GPIO_DT_SPEC_INST_GET_BY_IDX(inst, dio_gpios, idx), + GPIO_DT_SPEC_INST_GET_BY_IDX(inst, dio_gpios, idx) #define SX127X_DIO_GPIO_INIT(n) \ - UTIL_LISTIFY(SX127X_DIO_GPIO_LEN(n), SX127X_DIO_GPIO_ELEM, n) + LISTIFY(SX127X_DIO_GPIO_LEN(n), SX127X_DIO_GPIO_ELEM, (,), n) static const struct gpio_dt_spec sx127x_dios[] = { SX127X_DIO_GPIO_INIT(0) }; diff --git a/include/bluetooth/gatt.h b/include/bluetooth/gatt.h index 3dab8120d0..38532f6d67 100644 --- a/include/bluetooth/gatt.h +++ b/include/bluetooth/gatt.h @@ -539,9 +539,9 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, BT_GATT_SERVICE(attr_##_name) #define _BT_GATT_ATTRS_ARRAY_DEFINE(n, _instances, _attrs_def) \ - static struct bt_gatt_attr attrs_##n[] = _attrs_def(_instances[n]); + static struct bt_gatt_attr attrs_##n[] = _attrs_def(_instances[n]) -#define _BT_GATT_SERVICE_ARRAY_ITEM(_n, _) BT_GATT_SERVICE(attrs_##_n), +#define _BT_GATT_SERVICE_ARRAY_ITEM(_n, _) BT_GATT_SERVICE(attrs_##_n) /** @def BT_GATT_SERVICE_INSTANCE_DEFINE * @brief Statically define service structure array. @@ -562,11 +562,10 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn, _name, _instances, _instance_num, _attrs_def) \ BUILD_ASSERT(ARRAY_SIZE(_instances) == _instance_num, \ "The number of array elements does not match its size"); \ - UTIL_EVAL(UTIL_REPEAT( \ - _instance_num, _BT_GATT_ATTRS_ARRAY_DEFINE, _instances, \ - _attrs_def)) \ + LISTIFY(_instance_num, _BT_GATT_ATTRS_ARRAY_DEFINE, (;), \ + _instances, _attrs_def); \ static struct bt_gatt_service _name[] = { \ - UTIL_LISTIFY(_instance_num, _BT_GATT_SERVICE_ARRAY_ITEM) \ + LISTIFY(_instance_num, _BT_GATT_SERVICE_ARRAY_ITEM, (,)) \ } /** @def BT_GATT_SERVICE diff --git a/include/bluetooth/mesh/access.h b/include/bluetooth/mesh/access.h index 9c48796ae4..3f6b780586 100644 --- a/include/bluetooth/mesh/access.h +++ b/include/bluetooth/mesh/access.h @@ -15,14 +15,14 @@ #include /* Internal macros used to initialize array members */ -#define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED, -#define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED, +#define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED +#define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED #define BT_MESH_MODEL_KEYS_UNUSED \ - { UTIL_LISTIFY(CONFIG_BT_MESH_MODEL_KEY_COUNT, \ - BT_MESH_KEY_UNUSED_ELT_) } -#define BT_MESH_MODEL_GROUPS_UNASSIGNED \ - { UTIL_LISTIFY(CONFIG_BT_MESH_MODEL_GROUP_COUNT, \ - BT_MESH_ADDR_UNASSIGNED_ELT_) } + { LISTIFY(CONFIG_BT_MESH_MODEL_KEY_COUNT, \ + BT_MESH_KEY_UNUSED_ELT_, (,)) } +#define BT_MESH_MODEL_GROUPS_UNASSIGNED \ + { LISTIFY(CONFIG_BT_MESH_MODEL_GROUP_COUNT, \ + BT_MESH_ADDR_UNASSIGNED_ELT_, (,)) } /** * @brief Access layer diff --git a/include/drivers/pinctrl.h b/include/drivers/pinctrl.h index 9dea16a650..af3ddd4452 100644 --- a/include/drivers/pinctrl.h +++ b/include/drivers/pinctrl.h @@ -142,7 +142,7 @@ struct pinctrl_dev_config { COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \ (static const pinctrl_soc_pin_t \ Z_PINCTRL_STATE_PINS_NAME(state_idx, node_id)[] = \ - Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx);)) + Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx))) /** * @brief Helper macro to initialize a pin control state. @@ -157,7 +157,7 @@ struct pinctrl_dev_config { .pins = Z_PINCTRL_STATE_PINS_NAME(state_idx, node_id), \ .pin_cnt = ARRAY_SIZE(Z_PINCTRL_STATE_PINS_NAME(state_idx, \ node_id)) \ - },)) + })) /** * @brief Define all the states for the given node identifier. @@ -167,8 +167,8 @@ struct pinctrl_dev_config { #define Z_PINCTRL_STATES_DEFINE(node_id) \ static const struct pinctrl_state \ Z_PINCTRL_STATES_NAME(node_id)[] = { \ - UTIL_LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ - Z_PINCTRL_STATE_INIT, node_id) \ + LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ + Z_PINCTRL_STATE_INIT, (,), node_id) \ }; #ifdef CONFIG_PINCTRL_STORE_REG @@ -235,8 +235,8 @@ struct pinctrl_dev_config { * @param node_id Node identifier. */ #define PINCTRL_DT_DEFINE(node_id) \ - UTIL_LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ - Z_PINCTRL_STATE_PINS_DEFINE, node_id) \ + LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \ + Z_PINCTRL_STATE_PINS_DEFINE, (;), node_id); \ Z_PINCTRL_STATES_DEFINE(node_id) \ Z_PINCTRL_DEV_CONFIG_CONST Z_PINCTRL_DEV_CONFIG_STATIC \ struct pinctrl_dev_config Z_PINCTRL_DEV_CONFIG_NAME(node_id) = \ diff --git a/include/pm/state.h b/include/pm/state.h index d902b8ba9b..a53d0b5fe6 100644 --- a/include/pm/state.h +++ b/include/pm/state.h @@ -166,7 +166,7 @@ struct pm_state_info { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_INFO_FROM_DT_CPU(i, node_id) \ - PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), + PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)) /** * @brief Helper macro to initialize an entry of a struct pm_state array when @@ -176,7 +176,7 @@ struct pm_state_info { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_FROM_DT_CPU(i, node_id) \ - PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), + PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)) /** @endcond */ @@ -258,8 +258,8 @@ struct pm_state_info { */ #define PM_STATE_INFO_LIST_FROM_DT_CPU(node_id) \ { \ - UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ - Z_PM_STATE_INFO_FROM_DT_CPU, node_id) \ + LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ + Z_PM_STATE_INFO_FROM_DT_CPU, (,), node_id) \ } /** @@ -306,8 +306,8 @@ struct pm_state_info { */ #define PM_STATE_LIST_FROM_DT_CPU(node_id) \ { \ - UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ - Z_PM_STATE_FROM_DT_CPU, node_id) \ + LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ + Z_PM_STATE_FROM_DT_CPU, (,), node_id) \ } diff --git a/include/sys/util_macro.h b/include/sys/util_macro.h index bed84a7b8d..214cad5529 100644 --- a/include/sys/util_macro.h +++ b/include/sys/util_macro.h @@ -363,7 +363,7 @@ extern "C" { #define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__) /** - * @brief Generates a sequence of code. + * @brief Generates a sequence of code. Deprecated, use @ref LISTIFY. * * @deprecated Use @ref LISTIFY instead. * @@ -387,7 +387,7 @@ extern "C" { * @note Calling UTIL_LISTIFY with undefined arguments has undefined * behavior. */ -#define UTIL_LISTIFY(LEN, F, ...) LISTIFY(LEN, F, (), __VA_ARGS__) +#define UTIL_LISTIFY(LEN, F, ...) LISTIFY(LEN, F, (), __VA_ARGS__) __DEPRECATED_MACRO /** * @brief Call a macro @p F on each provided argument with a given diff --git a/soc/arm/atmel_sam/common/atmel_sam_dt.h b/soc/arm/atmel_sam/common/atmel_sam_dt.h index ca6d1ef781..8ddd1730f6 100644 --- a/soc/arm/atmel_sam/common/atmel_sam_dt.h +++ b/soc/arm/atmel_sam/common/atmel_sam_dt.h @@ -83,12 +83,12 @@ ATMEL_SAM_DT_NUM_PINS(DT_DRV_INST(inst)) /* internal macro to structure things for use with UTIL_LISTIFY */ -#define ATMEL_SAM_DT_PIN_ELEM(idx, node_id) ATMEL_SAM_DT_PIN(node_id, idx), +#define ATMEL_SAM_DT_PIN_ELEM(idx, node_id) ATMEL_SAM_DT_PIN(node_id, idx) /* Construct an array intializer for soc_gpio_pin for a device instance */ #define ATMEL_SAM_DT_PINS(node_id) \ - { UTIL_LISTIFY(ATMEL_SAM_DT_NUM_PINS(node_id), \ - ATMEL_SAM_DT_PIN_ELEM, node_id) \ + { LISTIFY(ATMEL_SAM_DT_NUM_PINS(node_id), \ + ATMEL_SAM_DT_PIN_ELEM, (,), node_id) \ } #define ATMEL_SAM_DT_INST_PINS(inst) \ diff --git a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h index 8d96c52ece..a33e8bbcf2 100644 --- a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h +++ b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h @@ -90,12 +90,12 @@ ATMEL_SAM0_DT_NUM_PINS(DT_DRV_INST(inst)) /* internal macro to structure things for use with UTIL_LISTIFY */ -#define ATMEL_SAM0_DT_PIN_ELEM(idx, node_id) ATMEL_SAM0_DT_PORT(node_id, idx), +#define ATMEL_SAM0_DT_PIN_ELEM(idx, node_id) ATMEL_SAM0_DT_PORT(node_id, idx) /* Construct an array intializer for soc_port_pin for a device instance */ #define ATMEL_SAM0_DT_PINS(node_id) \ - { UTIL_LISTIFY(ATMEL_SAM0_DT_NUM_PINS(node_id), \ - ATMEL_SAM0_DT_PIN_ELEM, node_id) \ + { LISTIFY(ATMEL_SAM0_DT_NUM_PINS(node_id), \ + ATMEL_SAM0_DT_PIN_ELEM, (,), node_id) \ } #define ATMEL_SAM0_DT_INST_PINS(inst) \ diff --git a/soc/arm/cypress/common/cypress_psoc6_dt.h b/soc/arm/cypress/common/cypress_psoc6_dt.h index a8bbe53aad..4447110e69 100644 --- a/soc/arm/cypress/common/cypress_psoc6_dt.h +++ b/soc/arm/cypress/common/cypress_psoc6_dt.h @@ -150,12 +150,12 @@ #define CY_PSOC6_DT_INST_NUM_PINS(inst) DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0) /* internal macro to structure things for use with UTIL_LISTIFY */ -#define CY_PSOC6_PIN_ELEM(idx, inst) CY_PSOC6_DT_INST_PIN(inst, idx), +#define CY_PSOC6_PIN_ELEM(idx, inst) CY_PSOC6_DT_INST_PIN(inst, idx) /* Construct an array intializer for soc_gpio_pin for a device instance */ #define CY_PSOC6_DT_INST_PINS(inst) \ - { UTIL_LISTIFY(CY_PSOC6_DT_INST_NUM_PINS(inst), \ - CY_PSOC6_PIN_ELEM, inst) \ + { LISTIFY(CY_PSOC6_DT_INST_NUM_PINS(inst), \ + CY_PSOC6_PIN_ELEM, (,), inst) \ } #endif /* _CYPRESS_PSOC6_SOC_DT_H_ */ diff --git a/soc/arm/nuvoton_npcx/common/soc_dt.h b/soc/arm/nuvoton_npcx/common/soc_dt.h index 0b9a2ed65f..3f3300bb03 100644 --- a/soc/arm/nuvoton_npcx/common/soc_dt.h +++ b/soc/arm/nuvoton_npcx/common/soc_dt.h @@ -78,7 +78,7 @@ .bus = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, bus), \ .ctrl = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, ctl), \ .bit = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, bit), \ - }, + } /** * @brief Length of 'clocks' property which type is 'phandle-array' @@ -119,10 +119,10 @@ * @param inst instance number for compatible defined in DT_DRV_COMPAT. * @return an array of npcx_clk_cfg items. */ -#define NPCX_DT_CLK_CFG_ITEMS_LIST(inst) { \ - UTIL_LISTIFY(NPCX_DT_CLK_CFG_ITEMS_LEN(inst), \ - NPCX_DT_CLK_CFG_ITEMS_FUNC, \ - inst) \ +#define NPCX_DT_CLK_CFG_ITEMS_LIST(inst) { \ + LISTIFY(NPCX_DT_CLK_CFG_ITEMS_LEN(inst), \ + NPCX_DT_CLK_CFG_ITEMS_FUNC, (,), \ + inst) \ } /** @@ -137,7 +137,7 @@ .group = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, group), \ .bit = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, bit), \ .inverted = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, inv), \ - }, + } /** * @brief Macro function to construct npcx_alt item in UTIL_LISTIFY extension. @@ -166,10 +166,10 @@ * @param inst instance number for compatible defined in DT_DRV_COMPAT. * @return an array of npcx_alt items. */ -#define NPCX_DT_ALT_ITEMS_LIST(inst) { \ - UTIL_LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \ - NPCX_DT_ALT_ITEMS_FUNC, \ - inst) \ +#define NPCX_DT_ALT_ITEMS_LIST(inst) { \ + LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \ + NPCX_DT_ALT_ITEMS_FUNC, (,), \ + inst) \ } /** @@ -225,7 +225,7 @@ alts, bit), \ .inverted = DT_PHA(NPCX_DT_IO_PHANDLE_FROM_PINCTRL(io_comp, inst, i),\ alts, inv), \ - }, + } /** * @brief Length of npcx_alt structures in 'pinctrl-0' property of specific @@ -274,10 +274,10 @@ * @param inst instance number for compatible defined in io_comp. * @return an array of npcx_alt items. */ -#define NPCX_DT_IO_ALT_ITEMS_LIST(io_comp, inst) { \ - UTIL_LISTIFY(NPCX_DT_IO_ALT_ITEMS_LEN(io_comp, inst), \ - NPCX_DT_IO_ALT_ITEMS_FUNC, \ - inst, io_comp) \ +#define NPCX_DT_IO_ALT_ITEMS_LIST(io_comp, inst) { \ + LISTIFY(NPCX_DT_IO_ALT_ITEMS_LEN(io_comp, inst), \ + NPCX_DT_IO_ALT_ITEMS_FUNC, (,), \ + inst, io_comp) \ } /** @@ -331,7 +331,7 @@ .group = DT_PHA(NPCX_DT_PHANDLE_FROM_WUI_MAPS(inst, i), miwus, \ group), \ .bit = DT_PHA(NPCX_DT_PHANDLE_FROM_WUI_MAPS(inst, i), miwus, bit), \ - }, + } /** * @brief Length of npcx_wui structures in 'wui-maps' property @@ -375,10 +375,10 @@ * @param inst instance number for compatible defined in DT_DRV_COMPAT. * @return an array of npcx_wui items. */ -#define NPCX_DT_WUI_ITEMS_LIST(inst) { \ - UTIL_LISTIFY(NPCX_DT_WUI_ITEMS_LEN(inst), \ - NPCX_DT_WUI_ITEMS_FUNC, \ - inst) \ +#define NPCX_DT_WUI_ITEMS_LIST(inst) { \ + LISTIFY(NPCX_DT_WUI_ITEMS_LEN(inst), \ + NPCX_DT_WUI_ITEMS_FUNC, (,), \ + inst) \ } /** @@ -532,7 +532,7 @@ lvols, ctrl), \ .bit = DT_PHA(NPCX_DT_PHANDLE_FROM_LVOL_IO_PADS(i), \ lvols, bit), \ - }, + } /** * @brief Macro function to construct a list of npcx_lvol items by UTIL_LISTIFY @@ -552,9 +552,9 @@ * * @return an array of npcx_lvol items which configure low-voltage support */ -#define NPCX_DT_IO_LVOL_ITEMS_DEF_LIST { \ - UTIL_LISTIFY(NPCX_DT_LVOL_ITEMS_LEN, \ - NPCX_DT_LVOL_ITEMS_BY_IDX, _) \ +#define NPCX_DT_IO_LVOL_ITEMS_DEF_LIST { \ + LISTIFY(NPCX_DT_LVOL_ITEMS_LEN, \ + NPCX_DT_LVOL_ITEMS_BY_IDX, (,), _) \ } /** @@ -645,7 +645,7 @@ .offset = DT_PROP(NPCX_DT_PHANDLE_FROM_PSL_IN_NODE(i), offset),\ .pinctrl = NPCX_DT_PSL_IN_ALT_CONF_BY_IDX(i) \ .polarity = NPCX_DT_PSL_IN_POL_CONF_BY_IDX(i) \ - }, + } /** * @brief Macro function to construct a list of npcx_psl_in items by @@ -666,9 +666,9 @@ * * @return an array of npcx_psl_in items which configures PSL input pads */ -#define NPCX_DT_PSL_IN_ITEMS_LIST { \ - UTIL_LISTIFY(NPCX_DT_PSL_IN_ITEMS_LEN, \ - NPCX_DT_PSL_IN_ITEMS_BY_IDX, _) \ +#define NPCX_DT_PSL_IN_ITEMS_LIST { \ + LISTIFY(NPCX_DT_PSL_IN_ITEMS_LEN, \ + NPCX_DT_PSL_IN_ITEMS_BY_IDX, (,), _) \ } /** diff --git a/soc/arm/st_stm32/common/st_stm32_dt.h b/soc/arm/st_stm32/common/st_stm32_dt.h index 3b0547d1b5..5f1300b24d 100644 --- a/soc/arm/st_stm32/common/st_stm32_dt.h +++ b/soc/arm/st_stm32/common/st_stm32_dt.h @@ -210,7 +210,7 @@ { \ ST_STM32_DT_INST_PINMUX(inst, x, i), \ ST_STM32_DT_INST_PINCFG(inst, x, i) \ - }, + } /** * @brief Internal: Contruct a soc_gpio_pinctrl element index i of @@ -225,7 +225,7 @@ { \ ST_STM32_DT_PINMUX(name, x, i), \ ST_STM32_DT_PINCFG(name, x, i) \ - }, + } /** * @brief Internal: Return the number of elements of a pinctrl-x property @@ -267,10 +267,10 @@ */ #define ST_STM32_DT_INST_PINCTRL(inst, x) \ { COND_CODE_1(DT_INST_PINCTRL_HAS_IDX(inst, x), \ - (UTIL_LISTIFY(ST_STM32_DT_INST_NUM_PINS(inst, x), \ - ST_STM32_DT_INST_PIN_ELEM, \ - x, \ - inst)), \ + (LISTIFY(ST_STM32_DT_INST_NUM_PINS(inst, x), \ + ST_STM32_DT_INST_PIN_ELEM, (,), \ + x, \ + inst)), \ ()) \ } @@ -288,10 +288,10 @@ */ #define ST_STM32_DT_PINCTRL(name, x) \ { COND_CODE_1(DT_PINCTRL_HAS_IDX(DT_NODELABEL(name), x), \ - (UTIL_LISTIFY(ST_STM32_DT_NUM_PINS(name, x), \ - ST_STM32_DT_PIN_ELEM, \ - x, \ - name)), \ + (LISTIFY(ST_STM32_DT_NUM_PINS(name, x), \ + ST_STM32_DT_PIN_ELEM, (,), \ + x, \ + name)), \ ()) \ } diff --git a/soc/riscv/riscv-ite/common/soc_dt.h b/soc/riscv/riscv-ite/common/soc_dt.h index 20bd900deb..6359a440d8 100644 --- a/soc/riscv/riscv-ite/common/soc_dt.h +++ b/soc/riscv/riscv-ite/common/soc_dt.h @@ -26,7 +26,7 @@ .pinctrls = IT8XXX2_DEV_PINMUX(idx, inst), \ .pin = IT8XXX2_DEV_PIN(idx, inst), \ .alt_fun = IT8XXX2_DEV_ALT_FUNC(idx, inst), \ - }, + } /** * @brief Macro function to construct a list of it8xxx2 alt items with @@ -35,10 +35,10 @@ * @param inst instance number for compatible defined in DT_DRV_COMPAT. * @return an array of it8xxx2 alt items. */ -#define IT8XXX2_DT_ALT_ITEMS_LIST(inst) { \ - UTIL_LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \ - IT8XXX2_DT_ALT_ITEMS_FUNC, \ - inst) \ +#define IT8XXX2_DT_ALT_ITEMS_LIST(inst) { \ + LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \ + IT8XXX2_DT_ALT_ITEMS_FUNC, (,), \ + inst) \ } #endif /* _ITE_IT8XXX2_SOC_DT_H_ */ diff --git a/subsys/bluetooth/audio/mics.c b/subsys/bluetooth/audio/mics.c index 5c72f9e515..575c947834 100644 --- a/subsys/bluetooth/audio/mics.c +++ b/subsys/bluetooth/audio/mics.c @@ -86,7 +86,7 @@ static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr, #define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL), -#define AICS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE) +#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ()) #define BT_MICS_SERVICE_DEFINITION \ BT_GATT_PRIMARY_SERVICE(BT_UUID_MICS), \ diff --git a/subsys/bluetooth/audio/vcs.c b/subsys/bluetooth/audio/vcs.c index eef6482761..4a563ad8f7 100644 --- a/subsys/bluetooth/audio/vcs.c +++ b/subsys/bluetooth/audio/vcs.c @@ -242,8 +242,8 @@ static ssize_t read_flags(struct bt_conn *conn, const struct bt_gatt_attr *attr, } #define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL), -#define VOCS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE) -#define AICS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE) +#define VOCS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ()) +#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ()) #define BT_VCS_SERVICE_DEFINITION \ BT_GATT_PRIMARY_SERVICE(BT_UUID_VCS), \ diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index c152ec1907..4c6b26b729 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -254,7 +254,7 @@ struct lll_event { uint8_t is_aborted:1; }; -#define DEFINE_NODE_RX_USER_TYPE(i, _) NODE_RX_TYPE_##i, +#define DEFINE_NODE_RX_USER_TYPE(i, _) NODE_RX_TYPE_##i enum node_rx_type { /* Unused */ @@ -307,7 +307,7 @@ enum node_rx_type { #if defined(CONFIG_BT_CTLR_USER_EXT) /* No entries shall be added after the NODE_RX_TYPE_USER_START/END */ NODE_RX_TYPE_USER_START, - UTIL_LISTIFY(CONFIG_BT_CTLR_USER_EVT_RANGE, DEFINE_NODE_RX_USER_TYPE, _) + LISTIFY(CONFIG_BT_CTLR_USER_EVT_RANGE, DEFINE_NODE_RX_USER_TYPE, (,), _), NODE_RX_TYPE_USER_END, #endif /* CONFIG_BT_CTLR_USER_EXT */ }; diff --git a/subsys/modbus/modbus_core.c b/subsys/modbus/modbus_core.c index 78b1ceebe7..9bc679b2d6 100644 --- a/subsys/modbus/modbus_core.c +++ b/subsys/modbus/modbus_core.c @@ -55,13 +55,13 @@ static struct modbus_serial_config modbus_serial_cfg[] = { .iface_name = "RAW_"#x, \ .raw_tx_cb = NULL, \ .mode = MODBUS_MODE_RAW, \ - }, + } static struct modbus_context mb_ctx_tbl[] = { DT_INST_FOREACH_STATUS_OKAY(MODBUS_DT_GET_DEV) #ifdef CONFIG_MODBUS_RAW_ADU - UTIL_LISTIFY(CONFIG_MODBUS_NUMOF_RAW_ADU, DEFINE_MODBUS_RAW_ADU, _) + LISTIFY(CONFIG_MODBUS_NUMOF_RAW_ADU, DEFINE_MODBUS_RAW_ADU, (,), _) #endif }; diff --git a/subsys/net/ip/net_tc.c b/subsys/net/ip/net_tc.c index 004aa593a9..612e3dc220 100644 --- a/subsys/net/ip/net_tc.c +++ b/subsys/net/ip/net_tc.c @@ -111,7 +111,7 @@ int net_rx_priority2tc(enum net_priority prio) #define BASE_PRIO_TX (CONFIG_NET_TC_TX_COUNT - 1) #endif -#define PRIO_TX(i, _) (BASE_PRIO_TX - i), +#define PRIO_TX(i, _) (BASE_PRIO_TX - i) #if IS_ENABLED(CONFIG_NET_TC_THREAD_COOPERATIVE) #define BASE_PRIO_RX (CONFIG_NET_TC_NUM_PRIORITIES - 1) @@ -119,7 +119,7 @@ int net_rx_priority2tc(enum net_priority prio) #define BASE_PRIO_RX (CONFIG_NET_TC_RX_COUNT - 1) #endif -#define PRIO_RX(i, _) (BASE_PRIO_RX - i), +#define PRIO_RX(i, _) (BASE_PRIO_RX - i) #if NET_TC_TX_COUNT > 0 /* Convert traffic class to thread priority */ @@ -158,7 +158,7 @@ static uint8_t tx_tc2thread(uint8_t tc) * priority. */ static const uint8_t thread_priorities[] = { - UTIL_LISTIFY(NET_TC_TX_COUNT, PRIO_TX) + LISTIFY(NET_TC_TX_COUNT, PRIO_TX, (,)) }; BUILD_ASSERT(NET_TC_TX_COUNT <= CONFIG_NUM_COOP_PRIORITIES, @@ -175,7 +175,7 @@ static uint8_t tx_tc2thread(uint8_t tc) static uint8_t rx_tc2thread(uint8_t tc) { static const uint8_t thread_priorities[] = { - UTIL_LISTIFY(NET_TC_RX_COUNT, PRIO_RX) + LISTIFY(NET_TC_RX_COUNT, PRIO_RX, (,)) }; BUILD_ASSERT(NET_TC_RX_COUNT <= CONFIG_NUM_COOP_PRIORITIES, diff --git a/subsys/net/l2/virtual/ipip/ipip.c b/subsys/net/l2/virtual/ipip/ipip.c index 1a43c4e019..d9b3497050 100644 --- a/subsys/net/l2/virtual/ipip/ipip.c +++ b/subsys/net/l2/virtual/ipip/ipip.c @@ -560,13 +560,13 @@ static const struct virtual_interface_api ipip_iface_api = { #define NET_IPIP_DATA(x, _) \ static struct ipip_context ipip_context_data_##x = { \ - }; + } #define NET_IPIP_INTERFACE_INIT(x, _) \ NET_VIRTUAL_INTERFACE_INIT(ipip##x, "IP_TUNNEL" #x, ipip_init, \ NULL, &ipip_context_data_##x, NULL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &ipip_iface_api, IPIPV4_MTU); + &ipip_iface_api, IPIPV4_MTU) -UTIL_LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_DATA, _) -UTIL_LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_INTERFACE_INIT, _) +LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_DATA, (;), _); +LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_INTERFACE_INIT, (;), _); diff --git a/subsys/net/lib/capture/capture.c b/subsys/net/lib/capture/capture.c index b826c01528..d351e9b206 100644 --- a/subsys/net/lib/capture/capture.c +++ b/subsys/net/lib/capture/capture.c @@ -691,7 +691,7 @@ static const struct net_capture_interface_api capture_interface_api = { }; #define DEFINE_NET_CAPTURE_DEV_DATA(x, _) \ - static struct net_capture capture_dev_data_##x; + static struct net_capture capture_dev_data_##x #define DEFINE_NET_CAPTURE_DEVICE(x, _) \ DEVICE_DEFINE(net_capture_##x, \ @@ -702,7 +702,7 @@ static const struct net_capture_interface_api capture_interface_api = { NULL, \ POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &capture_interface_api); + &capture_interface_api) -UTIL_LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEV_DATA, _) -UTIL_LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEVICE, _) +LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEV_DATA, (;), _); +LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEVICE, (;), _); diff --git a/subsys/pm/pm.c b/subsys/pm/pm.c index b465af9e37..8b8ebce08a 100644 --- a/subsys/pm/pm.c +++ b/subsys/pm/pm.c @@ -30,9 +30,9 @@ static sys_slist_t pm_notifiers = SYS_SLIST_STATIC_INIT(&pm_notifiers); * ACTIVE_STATE is 0 */ #define CPU_PM_STATE_INIT(_, __) \ - { .state = PM_STATE_ACTIVE }, + { .state = PM_STATE_ACTIVE } static struct pm_state_info z_cpus_pm_state[] = { - UTIL_LISTIFY(CONFIG_MP_NUM_CPUS, CPU_PM_STATE_INIT) + LISTIFY(CONFIG_MP_NUM_CPUS, CPU_PM_STATE_INIT, (,)) }; /* bitmask to check if a power state was forced. */ diff --git a/subsys/pm/state.c b/subsys/pm/state.c index 0905a91459..a1a48e1b62 100644 --- a/subsys/pm/state.c +++ b/subsys/pm/state.c @@ -23,7 +23,7 @@ BUILD_ASSERT(DT_NODE_EXISTS(DT_PATH(cpus)), min_residency_us, 0U) >= \ DT_PROP_BY_PHANDLE_IDX_OR(node_id, cpu_power_states, i, \ exit_latency_us, 0U), \ - "Found CPU power state with min_residency < exit_latency"); + "Found CPU power state with min_residency < exit_latency") /** * @brief Check CPU power states consistency @@ -33,8 +33,8 @@ BUILD_ASSERT(DT_NODE_EXISTS(DT_PATH(cpus)), * @param node_id A CPU node identifier. */ #define CHECK_POWER_STATES_CONSISTENCY(node_id) \ - UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ - CHECK_POWER_STATE_CONSISTENCY, node_id) \ + LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \ + CHECK_POWER_STATE_CONSISTENCY, (;), node_id); \ /* Check that all power states are consistent */ DT_FOREACH_CHILD(DT_PATH(cpus), CHECK_POWER_STATES_CONSISTENCY) diff --git a/subsys/testsuite/ztest/src/ztress.c b/subsys/testsuite/ztest/src/ztress.c index 4240664896..766caae182 100644 --- a/subsys/testsuite/ztest/src/ztress.c +++ b/subsys/testsuite/ztest/src/ztress.c @@ -41,10 +41,10 @@ static k_timeout_t init_backoff[CONFIG_ZTRESS_MAX_THREADS]; K_THREAD_STACK_ARRAY_DEFINE(stacks, CONFIG_ZTRESS_MAX_THREADS, CONFIG_ZTRESS_STACK_SIZE); static k_tid_t idle_tid; -#define THREAD_NAME(i, _) STRINGIFY(ztress_##i), +#define THREAD_NAME(i, _) STRINGIFY(ztress_##i) static const char * const thread_names[] = { - UTIL_LISTIFY(CONFIG_ZTRESS_MAX_THREADS, THREAD_NAME, _) + LISTIFY(CONFIG_ZTRESS_MAX_THREADS, THREAD_NAME, (,)) }; struct ztress_runtime { diff --git a/subsys/usb/class/audio/audio.c b/subsys/usb/class/audio/audio.c index 4598d2b700..2e2725972b 100644 --- a/subsys/usb/class/audio/audio.c +++ b/subsys/usb/class/audio/audio.c @@ -968,6 +968,6 @@ void usb_audio_register(const struct device *dev, DEFINE_AUDIO_DESCRIPTOR_BIDIR(dev, i, dev##_ID(i)); \ DEFINE_AUDIO_DEVICE(dev, i);) -UTIL_LISTIFY(HEADPHONES_DEVICE_COUNT, HEADPHONES_DEVICE, HP) -UTIL_LISTIFY(MICROPHONE_DEVICE_COUNT, MICROPHONE_DEVICE, MIC) -UTIL_LISTIFY(HEADSET_DEVICE_COUNT, HEADSET_DEVICE, HS) +LISTIFY(HEADPHONES_DEVICE_COUNT, HEADPHONES_DEVICE, (), HP) +LISTIFY(MICROPHONE_DEVICE_COUNT, MICROPHONE_DEVICE, (), MIC) +LISTIFY(HEADSET_DEVICE_COUNT, HEADSET_DEVICE, (), HS) diff --git a/subsys/usb/class/hid/core.c b/subsys/usb/class/hid/core.c index 39ae09ab54..0cae2c7e6f 100644 --- a/subsys/usb/class/hid/core.c +++ b/subsys/usb/class/hid/core.c @@ -117,7 +117,7 @@ struct usb_hid_config { INITIALIZER_IF_EP(AUTO_EP_OUT, \ USB_DC_EP_INTERRUPT, \ CONFIG_HID_INTERRUPT_EP_MPS), \ - }; + } #else #define DEFINE_HID_DESCR(x, _) \ USBD_CLASS_DESCR_DEFINE(primary, x) \ @@ -129,7 +129,7 @@ struct usb_hid_config { INITIALIZER_IF_EP(AUTO_EP_IN, \ USB_DC_EP_INTERRUPT, \ CONFIG_HID_INTERRUPT_EP_MPS), \ - }; + } #endif struct hid_device_info { @@ -599,12 +599,12 @@ static void hid_int_out(uint8_t ep, enum usb_dc_ep_cb_status_code ep_status) static struct usb_ep_cfg_data hid_ep_data_##x[] = { \ INITIALIZER_EP_DATA(hid_int_in, AUTO_EP_IN), \ INITIALIZER_EP_DATA(hid_int_out, AUTO_EP_OUT), \ - }; + } #else #define DEFINE_HID_EP(x, _) \ static struct usb_ep_cfg_data hid_ep_data_##x[] = { \ INITIALIZER_EP_DATA(hid_int_in, AUTO_EP_IN), \ - }; + } #endif static void hid_interface_config(struct usb_desc_header *head, @@ -634,7 +634,7 @@ static void hid_interface_config(struct usb_desc_header *head, }, \ .num_endpoints = ARRAY_SIZE(hid_ep_data_##x), \ .endpoint = hid_ep_data_##x, \ - }; + } int usb_hid_set_proto_code(const struct device *dev, uint8_t proto_code) { @@ -722,7 +722,7 @@ static int usb_hid_device_init(const struct device *dev) } #define DEFINE_HID_DEV_DATA(x, _) \ - struct hid_device_info usb_hid_dev_data_##x; + struct hid_device_info usb_hid_dev_data_##x #define DEFINE_HID_DEVICE(x, _) \ DEVICE_DEFINE(usb_hid_device_##x, \ @@ -732,10 +732,10 @@ static int usb_hid_device_init(const struct device *dev) &usb_hid_dev_data_##x, \ &hid_config_##x, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &hid_api); + &hid_api) -UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DESCR, _) -UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_EP, _) -UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_CFG_DATA, _) -UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEV_DATA, _) -UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEVICE, _) +LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DESCR, (;), _); +LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_EP, (;), _); +LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_CFG_DATA, (;), _); +LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEV_DATA, (;), _); +LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEVICE, (;), _); diff --git a/tests/bluetooth/bsim_bt/bsim_test_gatt/src/gatt_client_test.c b/tests/bluetooth/bsim_bt/bsim_test_gatt/src/gatt_client_test.c index 055c3b2447..394d2b6aa6 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_gatt/src/gatt_client_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_gatt/src/gatt_client_test.c @@ -19,9 +19,9 @@ static uint16_t chrc_handle; static uint16_t long_chrc_handle; static struct bt_uuid *test_svc_uuid = TEST_SERVICE_UUID; -#define ARRAY_ITEM(i, _) i, -static uint8_t chrc_data[] = { UTIL_LISTIFY(CHRC_SIZE, ARRAY_ITEM) }; /* 1, 2, 3 ... */ -static uint8_t long_chrc_data[] = { UTIL_LISTIFY(LONG_CHRC_SIZE, ARRAY_ITEM) }; /* 1, 2, 3 ... */ +#define ARRAY_ITEM(i, _) i +static uint8_t chrc_data[] = { LISTIFY(CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */ +static uint8_t long_chrc_data[] = { LISTIFY(LONG_CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */ static void connected(struct bt_conn *conn, uint8_t err) { diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index 588fab3f11..965887fabf 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -29,12 +29,12 @@ void *exp_user_data = (void *)199; struct counter_alarm_cfg alarm_cfg; struct counter_alarm_cfg alarm_cfg2; -#define INST_DT_COMPAT_LABEL(n, compat) DT_LABEL(DT_INST(n, compat)), +#define INST_DT_COMPAT_LABEL(n, compat) DT_LABEL(DT_INST(n, compat)) /* Generate a list of LABELs for all instances of the "compat" */ #define LABELS_FOR_DT_COMPAT(compat) \ COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \ - (UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(compat), \ - INST_DT_COMPAT_LABEL, compat)), ()) + (LISTIFY(DT_NUM_INST_STATUS_OKAY(compat), \ + INST_DT_COMPAT_LABEL, (,), compat),), ()) static const char * const devices[] = { #ifdef CONFIG_COUNTER_TIMER0 diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 38caee49fd..ebfdf48965 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -560,14 +560,14 @@ struct gpios_struct { /* Helper macro that UTIL_LISTIFY can use and produces an element with comma */ #define DT_PROP_ELEM_BY_PHANDLE(idx, node_id, ph_prop, prop) \ - DT_PROP_BY_PHANDLE_IDX(node_id, ph_prop, idx, prop), + DT_PROP_BY_PHANDLE_IDX(node_id, ph_prop, idx, prop) #define DT_PHANDLE_LISTIFY(node_id, ph_prop, prop) \ { \ - UTIL_LISTIFY(DT_PROP_LEN(node_id, ph_prop), \ - DT_PROP_ELEM_BY_PHANDLE, \ - node_id, \ - ph_prop, \ - label) \ + LISTIFY(DT_PROP_LEN(node_id, ph_prop), \ + DT_PROP_ELEM_BY_PHANDLE, (,), \ + node_id, \ + ph_prop, \ + label) \ } /* Helper macro that UTIL_LISTIFY can use and produces an element with comma */ @@ -576,10 +576,10 @@ struct gpios_struct { DT_PROP(DT_PHANDLE_BY_IDX(node_id, prop, idx), label), \ DT_PHA_BY_IDX(node_id, prop, idx, pin),\ DT_PHA_BY_IDX(node_id, prop, idx, flags),\ - }, + } #define DT_GPIO_LISTIFY(node_id, prop) \ - { UTIL_LISTIFY(DT_PROP_LEN(node_id, prop), DT_GPIO_ELEM, \ - node_id, prop) } + { LISTIFY(DT_PROP_LEN(node_id, prop), DT_GPIO_ELEM, (,), \ + node_id, prop) } #undef DT_DRV_COMPAT #define DT_DRV_COMPAT vnd_phandle_holder diff --git a/tests/subsys/logging/log_benchmark/src/main.c b/tests/subsys/logging/log_benchmark/src/main.c index 64b0590547..f634a560a8 100644 --- a/tests/subsys/logging/log_benchmark/src/main.c +++ b/tests/subsys/logging/log_benchmark/src/main.c @@ -97,8 +97,8 @@ struct backend_cb backend_ctrl_blk; int _cnt = 0; \ test_helpers_log_setup(); \ while (!test_helpers_log_dropped_pending()) { \ - LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \ - UTIL_LISTIFY(nargs, TEST_VALUE)); \ + LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \ + LISTIFY(nargs, TEST_VALUE, ())); \ _cnt++; \ } \ _cnt--; \ @@ -135,8 +135,8 @@ void test_log_capacity(void) test_helpers_log_setup(); \ uint32_t cyc = test_helpers_cycle_get(); \ for (int i = 0; i < _msg_cnt; i++) { \ - LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \ - UTIL_LISTIFY(nargs, TEST_VALUE)); \ + LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \ + LISTIFY(nargs, TEST_VALUE, ())); \ } \ cyc = test_helpers_cycle_get() - cyc; \ inc_time += cyc; \ @@ -175,8 +175,8 @@ void test_log_message_store_time_no_overwrite(void) TEST_LOG_CAPACITY(nargs, _dummy, 0); \ uint32_t cyc = test_helpers_cycle_get(); \ for (int i = 0; i < _msg_cnt; i++) { \ - LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \ - UTIL_LISTIFY(nargs, TEST_VALUE)); \ + LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \ + LISTIFY(nargs, TEST_VALUE, ())); \ } \ cyc = test_helpers_cycle_get() - cyc; \ inc_time += cyc; \ diff --git a/tests/subsys/usb/desc_sections/src/desc_sections.c b/tests/subsys/usb/desc_sections/src/desc_sections.c index 3f029f12b2..230f75ed42 100644 --- a/tests/subsys/usb/desc_sections/src/desc_sections.c +++ b/tests/subsys/usb/desc_sections/src/desc_sections.c @@ -78,7 +78,7 @@ struct usb_test_config { .if0_in2_ep = INITIALIZER_IF_EP(AUTO_EP_IN, \ USB_DC_EP_BULK, \ TEST_BULK_EP_MPS), \ - }; + } #define INITIALIZER_EP_DATA(cb, addr) \ { \ @@ -91,7 +91,7 @@ struct usb_test_config { INITIALIZER_EP_DATA(NULL, AUTO_EP_OUT), \ INITIALIZER_EP_DATA(NULL, AUTO_EP_IN), \ INITIALIZER_EP_DATA(NULL, AUTO_EP_IN), \ - }; + } #define DEFINE_TEST_CFG_DATA(x, _) \ USBD_DEFINE_CFG_DATA(test_config_##x) = { \ @@ -106,7 +106,7 @@ struct usb_test_config { }, \ .num_endpoints = ARRAY_SIZE(ep_cfg_##x), \ .endpoint = ep_cfg_##x, \ - }; + } #define NUM_INSTANCES 2 @@ -120,9 +120,9 @@ static void interface_config(struct usb_desc_header *head, if_desc->bInterfaceNumber = iface_num; } -UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_DESC, _) -UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_EP_CFG, _) -UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_CFG_DATA, _) +LISTIFY(NUM_INSTANCES, DEFINE_TEST_DESC, (;), _); +LISTIFY(NUM_INSTANCES, DEFINE_TEST_EP_CFG, (;), _); +LISTIFY(NUM_INSTANCES, DEFINE_TEST_CFG_DATA, (;), _); static struct usb_cfg_data *usb_get_cfg_data(struct usb_if_descriptor *iface) { diff --git a/tests/unit/util/test.inc b/tests/unit/util/test.inc index 687ba4480d..d17c49bb00 100644 --- a/tests/unit/util/test.inc +++ b/tests/unit/util/test.inc @@ -162,30 +162,6 @@ skipped: #undef test_IF_ENABLED_FLAG_B } -void test_UTIL_LISTIFY(void) -{ - int i = 0; - -#define INC(x, n, m) \ - do { \ - i += (x + n + m);\ - } while (0); - -#define DEFINE(x, y) int a##x = x * y; -#define MARK_UNUSED(x, _) ARG_UNUSED(a##x); - - UTIL_LISTIFY(4, DEFINE, 2) - UTIL_LISTIFY(4, MARK_UNUSED, _) - - UTIL_LISTIFY(4, INC, 1, 2) - - zassert_equal(i, 0 + 1 + 2 + 3 + 4 * (1 + 2), NULL); - zassert_equal(a0, 0, NULL); - zassert_equal(a1, 2, NULL); - zassert_equal(a2, 4, NULL); - zassert_equal(a3, 6, NULL); -} - void test_LISTIFY(void) { int ab0 = 1; @@ -473,7 +449,6 @@ void test_cc(void) ztest_unit_test(test_UTIL_OR), ztest_unit_test(test_UTIL_AND), ztest_unit_test(test_IF_ENABLED), - ztest_unit_test(test_UTIL_LISTIFY), ztest_unit_test(test_LISTIFY), ztest_unit_test(test_MACRO_MAP_CAT), ztest_unit_test(test_z_max_z_min_z_clamp),