Skip to content

Commit 6eb8176

Browse files
thughesKwsBaer
authored andcommitted
drivers: dma_wch: Add __used instead of disabling unused function warning
zephyrproject-rtos#84065 replaced diagnostic pragmas with TOOLCHAIN_* macros, but we don't need to use that here since __used is a cleaner way to indicate that the function is used and will also prevent it from being optimized away at link time if LTO is enabled. Signed-off-by: Tom Hughes <[email protected]>
1 parent a0d306c commit 6eb8176

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/dma/dma_wch.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static DEVICE_API(dma, dma_wch_driver_api) = {
450450
};
451451

452452
#define GENERATE_ISR(ch, _) \
453-
static void dma_wch_isr##ch(const struct device *dev) \
453+
__used static void dma_wch_isr##ch(const struct device *dev) \
454454
{ \
455455
if (ch <= DMA_WCH_MAX_CHAN_BASE) { \
456456
dma_wch_isr(dev, ch); \
@@ -459,10 +459,7 @@ static DEVICE_API(dma, dma_wch_driver_api) = {
459459
} \
460460
}
461461

462-
#pragma GCC diagnostic push
463-
#pragma GCC diagnostic ignored "-Wunused-function"
464462
LISTIFY(DMA_WCH_MAX_CHAN, GENERATE_ISR, ())
465-
#pragma GCC diagnostic pop
466463

467464
#define IRQ_CONFIGURE(n, idx) \
468465
IRQ_CONNECT(DT_INST_IRQ_BY_IDX(idx, n, irq), DT_INST_IRQ_BY_IDX(idx, n, priority), \

0 commit comments

Comments
 (0)