Introduce USED_ATTR wrapper for __attribute__((used)).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31188 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Boris Gjenero 2011-12-09 15:33:59 +00:00
parent 9653ae364c
commit 59e71ee80c
11 changed files with 35 additions and 10 deletions

View file

@ -57,4 +57,13 @@
#define FORCE_INLINE inline
#endif
/* Version information from http://ohse.de/uwe/articles/gcc-attributes.html */
#if defined(__GNUC__) && (__GNUC__ >= 4 || \
(__GNUC__ >= 3 && __GNUC_MINOR__ >= 1))
#define USED_ATTR __attribute__((used))
#else
#define USED_ATTR
#endif
#endif /* _GCC_EXTENSIONS_H_ */

View file

@ -29,6 +29,7 @@
#include "avic-imx31.h"
#include "dvfs_dptc-imx31.h"
#include "dvfs_dptc_tables-target.h"
#include "gcc_extensions.h"
/* Most of the code in here is based upon the Linux BSP provided by Freescale
* Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved. */
@ -181,7 +182,7 @@ static void set_current_dvfs_level(unsigned int level)
}
/* DVFS Interrupt handler */
static void __attribute__((used)) dvfs_int(void)
static void USED_ATTR dvfs_int(void)
{
unsigned long pmcr0 = CCM_PMCR0;
unsigned long fsvai = pmcr0 & CCM_PMCR0_FSVAI;

View file

@ -23,6 +23,7 @@
#include "panic.h"
#include "mmu-arm.h"
#include "cpu.h"
#include "gcc_extensions.h"
#define default_interrupt(name) \
extern __attribute__((weak,alias("UIRQ"))) void name (void)
@ -60,7 +61,7 @@ default_interrupt(SPI1);
default_interrupt(RTC);
default_interrupt(ADC);
static void (* const irqvector[32])(void) __attribute__((__used__)) =
static void (* const irqvector[32])(void) USED_ATTR =
{
EINT0, EINT1, EINT2, EINT3,
EINT4_7, EINT8_23, CAM, nBATT_FLT, TICK, WDT_AC97,

View file

@ -21,11 +21,13 @@
*
****************************************************************************/
#include "gcc_extensions.h"
/*---------------------------------------------------------------------------
* Start the thread running and terminate it if it returns
*---------------------------------------------------------------------------
*/
static void __attribute__((naked,used)) start_thread(void)
static void __attribute__((naked)) USED_ATTR start_thread(void)
{
/* r0 = context */
asm volatile (

View file

@ -21,6 +21,8 @@
*
****************************************************************************/
#include "gcc_extensions.h"
#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
/* Support a special workaround object for large-sector disks */
#define IF_NO_SKIP_YIELD(...) __VA_ARGS__
@ -546,7 +548,7 @@ void core_wake(unsigned int othercore)
#endif /* CPU_PPxxxx */
/* Keep constant pool in range of inline ASM */
static void __attribute__((naked, used)) dump_ltorg(void)
static void __attribute__((naked)) USED_ATTR dump_ltorg(void)
{
asm volatile (".ltorg");
}

View file

@ -171,7 +171,7 @@ default_interrupt (ADC); /* A/D converter */
#endif
static void system_display_exception_info(unsigned long format,
unsigned long pc) __attribute__ ((noreturn, used));
unsigned long pc) __attribute__ ((noreturn)) USED_ATTR;
static void system_display_exception_info(unsigned long format,
unsigned long pc)
{

View file

@ -21,12 +21,14 @@
*
****************************************************************************/
#include "gcc_extensions.h"
/*---------------------------------------------------------------------------
* Start the thread running and terminate it if it returns
*---------------------------------------------------------------------------
*/
void start_thread(void); /* Provide C access to ASM label */
static void __attribute__((used)) __start_thread(void)
static void USED_ATTR __start_thread(void)
{
/* a0=macsr, a1=context */
asm volatile (

View file

@ -23,11 +23,13 @@
****************************************************************************/
#include <system.h>
#include "gcc_extensions.h"
/*---------------------------------------------------------------------------
* Start the thread running and terminate it if it returns
*---------------------------------------------------------------------------
*/
static void __attribute__((naked,used)) start_thread(void)
static void __attribute__((naked)) USED_ATTR start_thread(void)
{
/* r0 = context */
asm volatile (

View file

@ -21,13 +21,15 @@
*
****************************************************************************/
#include "gcc_extensions.h"
/*---------------------------------------------------------------------------
* Start the thread running and terminate it if it returns
*---------------------------------------------------------------------------
*/
void start_thread(void); /* Provide C access to ASM label */
static void __attribute__((used)) _start_thread(void)
static void USED_ATTR _start_thread(void)
{
/* t1 = context */
asm volatile (

View file

@ -21,12 +21,14 @@
*
****************************************************************************/
#include "gcc_extensions.h"
/*---------------------------------------------------------------------------
* Start the thread running and terminate it if it returns
*---------------------------------------------------------------------------
*/
void start_thread(void); /* Provide C access to ASM label */
static void __attribute__((used)) __start_thread(void)
static void USED_ATTR __start_thread(void)
{
/* r8 = context */
asm volatile (

View file

@ -30,6 +30,8 @@
#ifdef RB_PROFILE
#include <profile.h>
#endif
#include "gcc_extensions.h"
/****************************************************************************
* ATTENTION!! *
* See notes below on implementing processor-specific portions! *
@ -163,7 +165,7 @@ static inline void load_context(const void* addr)
#if NUM_CORES > 1
static void thread_final_exit_do(struct thread_entry *current)
__attribute__((noinline, noreturn, used));
__attribute__((noinline, noreturn)) USED_ATTR;
#else
static inline void thread_final_exit(struct thread_entry *current)
__attribute__((always_inline, noreturn));