diff --git a/bsp/at32/Libraries/rt_drivers/drv_gpio.c b/bsp/at32/Libraries/rt_drivers/drv_gpio.c index 0c1c725f07cd1aedc7c0a48092c4a34c073f5c43..68b56c2485c8a2dfa7cbf3ecb14726ea3788e231 100644 --- a/bsp/at32/Libraries/rt_drivers/drv_gpio.c +++ b/bsp/at32/Libraries/rt_drivers/drv_gpio.c @@ -205,11 +205,13 @@ rt_inline const struct pin_irq_map *get_pin_irq_map(uint32_t pinbit) static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args) { - RT_UNUSED GPIO_Type *gpio_port; + GPIO_Type *gpio_port; uint16_t gpio_pin; rt_base_t level; rt_int32_t irqindex = -1; + RT_UNUSED(gpio_port); + if (PIN_PORT(pin) < PIN_ATPORT_MAX) { gpio_port = PIN_ATPORT(pin); @@ -251,11 +253,13 @@ static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, static rt_err_t at32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin) { - RT_UNUSED GPIO_Type *gpio_port; + GPIO_Type *gpio_port; uint16_t gpio_pin; rt_base_t level; rt_int32_t irqindex = -1; + RT_UNUSED(gpio_port); + if (PIN_PORT(pin) < PIN_ATPORT_MAX) { gpio_port = PIN_ATPORT(pin); diff --git a/bsp/lpc2148/drivers/serial.c b/bsp/lpc2148/drivers/serial.c index 36bbcbd608d08972dfbb0bfdb1ca59d73e2b16a6..4fff9c78c8615a0d3840f80c8fe4edf54902e0a3 100644 --- a/bsp/lpc2148/drivers/serial.c +++ b/bsp/lpc2148/drivers/serial.c @@ -62,10 +62,12 @@ void rt_hw_serial_init(void); void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial) { - RT_UNUSED rt_uint32_t iir; + rt_uint32_t iir; RT_ASSERT(lpc_serial != RT_NULL) + RT_UNUSED(iir); + if (UART_LSR(lpc_serial->hw_base) & 0x01) { rt_base_t level; diff --git a/bsp/lpc2478/drivers/serial.c b/bsp/lpc2478/drivers/serial.c index 8e1fe1f91fe6db37e441c99cbea2f4eaf439b08f..e53b5075dcb6e23e2f35fd83a018a911c13ad064 100644 --- a/bsp/lpc2478/drivers/serial.c +++ b/bsp/lpc2478/drivers/serial.c @@ -62,11 +62,13 @@ void rt_hw_serial_init(void); void rt_hw_uart_isr(int irqno, void *param) { - RT_UNUSED rt_uint32_t iir; + rt_uint32_t iir; struct rt_lpcserial* lpc_serial = (struct rt_lpcserial*)param; RT_ASSERT(lpc_serial != RT_NULL) + RT_UNUSED(iir); + if (UART_LSR(lpc_serial->hw_base) & 0x01) { rt_base_t level; diff --git a/bsp/mini4020/drivers/board.c b/bsp/mini4020/drivers/board.c index b77d8faf59e2423cbd363483d3f3b8f77a6d88cf..f9c90f6d1baa6a4ccc21dc08f127f9a8d847cd55 100644 --- a/bsp/mini4020/drivers/board.c +++ b/bsp/mini4020/drivers/board.c @@ -51,7 +51,9 @@ void rt_serial_handler(int vector, void *param) { //rt_kprintf("in rt_serial_handler\n"); rt_int32_t stat = *(RP)UART0_IIR ; - RT_UNUSED char c; + char c; + + RT_UNUSED(c); /*Received data*/ if (((stat & 0x0E) >> 1) == 0x02) diff --git a/bsp/mini4020/drivers/sdcard.c b/bsp/mini4020/drivers/sdcard.c index 52c3b5cd8252275cc4958da40c45d55c569d48b0..bf2192382f95b9861ed6d098272de3ab8c40f926 100644 --- a/bsp/mini4020/drivers/sdcard.c +++ b/bsp/mini4020/drivers/sdcard.c @@ -263,11 +263,13 @@ static rt_err_t sd_readblock(rt_uint32_t address, rt_uint8_t *buf) U32 complete, i; rt_uint8_t temp; rt_err_t err; - RT_UNUSED rt_uint32_t discard; + rt_uint32_t discard; #ifdef USE_TIMEOUT rt_uint32_t to = 10; #endif + RT_UNUSED(discard); + //rt_kprintf("in readblock:%x\n",address); //Clear all the errors & interrups *(RP)DMAC_INTINTERRCLR |= 0x1; diff --git a/include/rtdef.h b/include/rtdef.h index b45b304aa8bd753a746cc0af64fee63955a64f0c..2cf63b6a4c5c56e115d7b0520842576e57a6d7f7 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -37,6 +37,7 @@ * 2021-03-19 Meco Man add security devices * 2021-05-10 armink change version number to v4.0.4 * 2021-11-19 Meco Man change version number to v4.1.0 + * 2021-12-21 Meco Man re-implement RT_UNUSED */ #ifndef __RT_DEF_H__ @@ -118,14 +119,14 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define __CLANG_ARM #endif +#define RT_UNUSED(x) ((void)x) + /* Compiler Related Definitions */ #if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */ #include #define RT_SECTION(x) __attribute__((section(x))) - #define RT_UNUSED __attribute__((unused)) #define RT_USED __attribute__((used)) #define ALIGN(n) __attribute__((aligned(n))) - #define RT_WEAK __attribute__((weak)) #define rt_inline static __inline /* module compiling */ @@ -133,19 +134,16 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define RTT_API __declspec(dllimport) #else #define RTT_API __declspec(dllexport) - #endif - + #endif /* RT_USING_MODULE */ #elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */ #include #define RT_SECTION(x) @ x - #define RT_UNUSED #define RT_USED __root #define PRAGMA(x) _Pragma(#x) #define ALIGN(n) PRAGMA(data_alignment=n) #define RT_WEAK __weak #define rt_inline static inline #define RTT_API - #elif defined (__GNUC__) /* GNU GCC Compiler */ #ifdef RT_USING_NEWLIB #include @@ -156,10 +154,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define va_start(v,l) __builtin_va_start(v,l) #define va_end(v) __builtin_va_end(v) #define va_arg(v,l) __builtin_va_arg(v,l) - #endif - + #endif /* RT_USING_NEWLIB */ #define RT_SECTION(x) __attribute__((section(x))) - #define RT_UNUSED __attribute__((unused)) #define RT_USED __attribute__((used)) #define ALIGN(n) __attribute__((aligned(n))) #define RT_WEAK __attribute__((weak)) @@ -168,7 +164,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */ #include #define RT_SECTION(x) __attribute__((section(x))) - #define RT_UNUSED __attribute__((unused)) #define RT_USED __attribute__((used)) #define ALIGN(n) __attribute__((aligned(n))) #define RT_WEAK __attribute__((weak)) @@ -177,7 +172,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #elif defined (_MSC_VER) #include #define RT_SECTION(x) - #define RT_UNUSED #define RT_USED #define ALIGN(n) __declspec(align(n)) #define RT_WEAK @@ -189,7 +183,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ * GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more * details. */ #define RT_SECTION(x) - #define RT_UNUSED #define RT_USED #define PRAGMA(x) _Pragma(#x) #define ALIGN(n) @@ -199,7 +192,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #elif defined (__TASKING__) #include #define RT_SECTION(x) __attribute__((section(x))) - #define RT_UNUSED __attribute__((unused)) #define RT_USED __attribute__((used, protect)) #define PRAGMA(x) _Pragma(#x) #define ALIGN(n) __attribute__((__align(n)))