Replace __attribute__ ((unused)) with unused_code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-07-27 21:11:56 +08:00 committed by Gustavo Henrique Nihei
parent 69df58c2e8
commit 5d1a444812
9 changed files with 38 additions and 43 deletions

View File

@ -77,10 +77,6 @@
#define APDID_HPADC 12 #define APDID_HPADC 12
#define APDID_LPADC 13 #define APDID_LPADC 13
/* Compiler hint shortcut */
#define __unused __attribute__((unused))
#define ALIGNUP(v, a) (((v) + ((a) - 1)) & ~((a) - 1)) #define ALIGNUP(v, a) (((v) + ((a) - 1)) & ~((a) - 1))
#define TILESIZESHIT 17 #define TILESIZESHIT 17
#define TILESIZE (1 << TILESIZESHIT) #define TILESIZE (1 << TILESIZESHIT)
@ -133,11 +129,11 @@ static void cxd56_img_clock_enable(void);
static void cxd56_img_clock_disable(void); static void cxd56_img_clock_disable(void);
static void cxd56_scu_clock_ctrl(uint32_t block, uint32_t intr, int on); static void cxd56_scu_clock_ctrl(uint32_t block, uint32_t intr, int on);
static void cxd56_scu_peri_clock_enable(FAR const struct scu_peripheral *p) static void cxd56_scu_peri_clock_enable(FAR const struct scu_peripheral *p)
__unused; unused_code;
static void cxd56_scu_peri_clock_disable(FAR const struct scu_peripheral *p) static void cxd56_scu_peri_clock_disable(FAR const struct scu_peripheral *p)
__unused; unused_code;
static void cxd56_scu_peri_clock_gating(FAR const struct scu_peripheral *p, static void cxd56_scu_peri_clock_gating(FAR const struct scu_peripheral *p,
int enable) __unused; int enable) unused_code;
/**************************************************************************** /****************************************************************************
* Public Data * Public Data

View File

@ -182,7 +182,7 @@ static int cxd56_farapidonehandler(int cpuid, int protoid,
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
__attribute__((used)) unused_code
void farapi_main(int id, void *arg, struct modulelist_s *mlist) void farapi_main(int id, void *arg, struct modulelist_s *mlist)
{ {
struct farmsg_s msg; struct farmsg_s msg;

View File

@ -43,8 +43,6 @@
#define FIFOMEMSIZE 40960 #define FIFOMEMSIZE 40960
#define __unused __attribute__((unused))
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/

View File

@ -57,14 +57,6 @@
#ifdef CONFIG_CXD56_SPI #ifdef CONFIG_CXD56_SPI
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __unused
#define __unused __attribute__((unused))
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -110,9 +102,9 @@ static inline void spi_putreg(FAR struct cxd56_spidev_s *priv,
/* DMA support */ /* DMA support */
#ifdef CONFIG_CXD56_DMAC #ifdef CONFIG_CXD56_DMAC
static void __unused spi_dmaexchange(FAR struct spi_dev_s *dev, static void unused_code spi_dmaexchange(FAR struct spi_dev_s *dev,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords); FAR void *rxbuffer, size_t nwords);
static void spi_dmatrxwait(FAR struct cxd56_spidev_s *priv); static void spi_dmatrxwait(FAR struct cxd56_spidev_s *priv);
static void spi_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *data); static void spi_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *data);
static void spi_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *data); static void spi_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *data);
@ -134,10 +126,10 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits); static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
static uint32_t spi_send(FAR struct spi_dev_s *dev, uint32_t wd); static uint32_t spi_send(FAR struct spi_dev_s *dev, uint32_t wd);
static void __unused spi_exchange(FAR struct spi_dev_s *dev, static void unused_code spi_exchange(FAR struct spi_dev_s *dev,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, FAR void *rxbuffer,
size_t nwords); size_t nwords);
#ifndef CONFIG_SPI_EXCHANGE #ifndef CONFIG_SPI_EXCHANGE
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
size_t nwords); size_t nwords);

View File

@ -57,10 +57,6 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#ifndef __unused
#define __unused __attribute__((unused))
#endif
/* 8 frame FIFOs for both transmit and receive */ /* 8 frame FIFOs for both transmit and receive */
#define RP2040_SPI_FIFOSZ 8 #define RP2040_SPI_FIFOSZ 8
@ -110,9 +106,9 @@ static inline void spi_putreg(FAR struct rp2040_spidev_s *priv,
/* DMA support */ /* DMA support */
#ifdef CONFIG_RP2040_SPI_DMA #ifdef CONFIG_RP2040_SPI_DMA
static void __unused spi_dmaexchange(FAR struct spi_dev_s *dev, static void unused_code spi_dmaexchange(FAR struct spi_dev_s *dev,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords); FAR void *rxbuffer, size_t nwords);
static void spi_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *data); static void spi_dmatxcallback(DMA_HANDLE handle, uint8_t status, void *data);
static void spi_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *data); static void spi_dmarxcallback(DMA_HANDLE handle, uint8_t status, void *data);
static void spi_dmatxsetup(FAR struct rp2040_spidev_s *priv, static void spi_dmatxsetup(FAR struct rp2040_spidev_s *priv,
@ -136,10 +132,10 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits); static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
static uint32_t spi_send(FAR struct spi_dev_s *dev, uint32_t wd); static uint32_t spi_send(FAR struct spi_dev_s *dev, uint32_t wd);
static void __unused spi_exchange(FAR struct spi_dev_s *dev, static void unused_code spi_exchange(FAR struct spi_dev_s *dev,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, FAR void *rxbuffer,
size_t nwords); size_t nwords);
#ifndef CONFIG_SPI_EXCHANGE #ifndef CONFIG_SPI_EXCHANGE
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
size_t nwords); size_t nwords);

View File

@ -76,8 +76,7 @@ uint8_t g_idle_stack[BL602_IDLESTACK_SIZE]
* g_boot2_partition_table in linker script * g_boot2_partition_table in linker script
*/ */
static struct boot2_partition_table_s g_boot2_partition_table static struct boot2_partition_table_s g_boot2_partition_table unused_data;
__attribute__((used));
/**************************************************************************** /****************************************************************************
* Public Data * Public Data

View File

@ -329,8 +329,8 @@ static void up_apic_init(void)
* *
****************************************************************************/ ****************************************************************************/
static int __attribute__((unused)) static int unused_code
legacy_pic_irq_handler(int irq, uint32_t *regs, void *arg) legacy_pic_irq_handler(int irq, uint32_t *regs, void *arg)
{ {
return 0; return 0;
} }

View File

@ -147,6 +147,11 @@
# define noinstrument_function __attribute__ ((no_instrument_function)) # define noinstrument_function __attribute__ ((no_instrument_function))
/* The unsued code or data */
# define unused_code __attribute__((unused))
# define unused_data __attribute__((unused))
/* Some versions of GCC have a separate __syslog__ format. /* Some versions of GCC have a separate __syslog__ format.
* http://mail-index.netbsd.org/source-changes/2015/10/14/msg069435.html * http://mail-index.netbsd.org/source-changes/2015/10/14/msg069435.html
* Use it if available. Otherwise, assume __printf__ accepts %m. * Use it if available. Otherwise, assume __printf__ accepts %m.
@ -404,6 +409,9 @@
# define noinline_function # define noinline_function
# define noinstrument_function # define noinstrument_function
# define unused_code
# define unused_data
# define printflike(a, b) # define printflike(a, b)
# define sysloglike(a, b) # define sysloglike(a, b)
# define scanflike(a, b) # define scanflike(a, b)
@ -536,6 +544,8 @@
# define inline_function # define inline_function
# define noinline_function # define noinline_function
# define noinstrument_function # define noinstrument_function
# define unused_code
# define unused_data
# define printflike(a, b) # define printflike(a, b)
# define sysloglike(a, b) # define sysloglike(a, b)
# define scanflike(a, b) # define scanflike(a, b)
@ -641,6 +651,8 @@
# define inline_function # define inline_function
# define noinline_function # define noinline_function
# define noinstrument_function # define noinstrument_function
# define unused_code
# define unused_data
# define printflike(a, b) # define printflike(a, b)
# define sysloglike(a, b) # define sysloglike(a, b)
# define scanflike(a, b) # define scanflike(a, b)
@ -701,6 +713,8 @@
# define inline_function # define inline_function
# define noinline_function # define noinline_function
# define noinstrument_function # define noinstrument_function
# define unused_code
# define unused_data
# define printflike(a, b) # define printflike(a, b)
# define sysloglike(a, b) # define sysloglike(a, b)
# define scanflike(a, b) # define scanflike(a, b)

View File

@ -81,7 +81,7 @@
#define SPLAY_ENTRY(type) \ #define SPLAY_ENTRY(type) \
struct \ struct \
{ \ { \
struct type *spe_left; /* left element */ \ struct type *spe_left; /* left element */ \
struct type *spe_right; /* right element */ \ struct type *spe_right; /* right element */ \
} }
@ -516,7 +516,7 @@ while (0)
#define RB_PROTOTYPE(name, type, field, cmp) \ #define RB_PROTOTYPE(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ #define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static) RB_PROTOTYPE_INTERNAL(name, type, field, cmp, unused_code static)
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ #define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *); \ attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *); \
@ -536,7 +536,7 @@ while (0)
RB_GENERATE_INTERNAL(name, type, field, cmp,) RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define RB_GENERATE_STATIC(name, type, field, cmp) \ #define RB_GENERATE_STATIC(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static) RB_GENERATE_INTERNAL(name, type, field, cmp, unused_code static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
attr void name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ attr void name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \