bug 826481 - mark PrepareAndDispatch() as __attribute__((used)) when building with gcc or clang r=froydnj

This commit is contained in:
Trevor Saunders 2014-01-17 16:17:20 -05:00
parent bddb4a0f97
commit f25cd1be9f
34 changed files with 38 additions and 46 deletions

View File

@ -15,5 +15,3 @@
#define SYMBOL_UNDERSCORE
#endif
#define ATTRIBUTE_USED __attribute__ ((__used__))

View File

@ -11,7 +11,7 @@
/* Prototype specifies unmangled function name and disables unused warning */
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
__asm__("PrepareAndDispatch") __attribute__((used));
__asm__("PrepareAndDispatch") ATTRIBUTE_USED;
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)

View File

@ -28,7 +28,7 @@ const uint32_t FPR_COUNT = 8;
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gpregs, double *fpregs)
{

View File

@ -12,21 +12,9 @@
#error "This code is for Linux ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour."
#endif
#ifdef __GNUC__
/* This tells gcc3.4+ not to optimize away symbols.
* @see http://gcc.gnu.org/gcc-3.4/changes.html
*/
#define DONT_DROP_OR_WARN __attribute__((used))
#else
/* This tells older gccs not to warn about unused vairables.
* @see http://docs.freebsd.org/info/gcc/gcc.info.Variable_Attributes.html
*/
#define DONT_DROP_OR_WARN __attribute__((unused))
#endif
/* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
DONT_DROP_OR_WARN;
ATTRIBUTE_USED;
#ifdef __ARM_EABI__
#define DOUBLEWORD_ALIGN(p) ((uint32_t *)((((uint32_t)(p)) + 7) & 0xfffffff8))

View File

@ -7,7 +7,7 @@
#include "xptcprivate.h"
nsresult
nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

View File

@ -24,7 +24,7 @@
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
DONT_DROP_OR_WARN;
static nsresult
static nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

View File

@ -16,7 +16,7 @@
/* Implement shared vtbl methods. */
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint64_t* intargs, uint64_t* floatargs, uint64_t* restargs)
{

View File

@ -17,7 +17,7 @@
/* Implement shared vtbl methods. */
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint64_t* intargs, uint64_t* floatargs, uint64_t* restargs)
{

View File

@ -11,7 +11,7 @@
/* Prototype specifies unmangled function name and disables unused warning */
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
__asm__("PrepareAndDispatch") __attribute__((used));
__asm__("PrepareAndDispatch") ATTRIBUTE_USED;
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)

View File

@ -9,7 +9,7 @@
#include "xptiprivate.h"
extern "C" {
nsresult
nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

View File

@ -9,7 +9,7 @@
#include "xptcprivate.h"
#include "xptiprivate.h"
static nsresult
static nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint32_t* a_gpr, uint64_t *a_fpr, uint32_t *a_ov)
{

View File

@ -9,7 +9,7 @@
#include "xptcprivate.h"
#include "xptiprivate.h"
static nsresult
static nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint64_t* a_gpr, uint64_t *a_fpr, uint64_t *a_ov)
{

View File

@ -15,7 +15,7 @@
* Args contains a0-3 and then the stack.
* Because a0 is 'this', we want to skip it
*/
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
args++; // always skip over a0

View File

@ -20,7 +20,7 @@
* they are stored on the stack at address "args".
*
*/
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args,
uint64_t *gprData, double *fprData)
{

View File

@ -12,7 +12,7 @@
#endif
extern "C" {
static nsresult
static nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

View File

@ -14,7 +14,7 @@
#error "This code is for HP-PA RISC 32 bit mode only"
#endif
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint32_t* args, uint32_t* floatargs)
{

View File

@ -32,7 +32,7 @@
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
#include <stdio.h>
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self,
uint64_t methodIndex,
uint64_t* args,

View File

@ -16,7 +16,7 @@
The args pointer has been set to the start of the parameters BEYOND the ones
arriving in registers
*/
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args, uint32_t *gprData, double *fprData)
{
typedef struct {

View File

@ -15,7 +15,7 @@
The args pointer has been set to the start of the parameters BEYOND the ones
arriving in registers
*/
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args, uint64_t *gprData, double *fprData)
{

View File

@ -31,7 +31,7 @@
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self,
uint32_t methodIndex,
uint32_t* args,

View File

@ -27,7 +27,7 @@
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self,
uint32_t methodIndex,
uint32_t* args,

View File

@ -28,7 +28,7 @@
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self,
uint32_t methodIndex,
uint32_t* args,

View File

@ -35,7 +35,7 @@
* http://developer.apple.com/documentation/DeveloperTools/Conceptual/
* MachORuntime/PowerPCConventions/chapter_3_section_1.html */
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(
nsXPTCStubBase *self,
uint32_t methodIndex,

View File

@ -11,7 +11,7 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args)
{

View File

@ -9,7 +9,7 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{

View File

@ -9,7 +9,7 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{

View File

@ -10,7 +10,7 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{

View File

@ -11,7 +11,7 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args)
{

View File

@ -30,7 +30,7 @@ const uint32_t FPR_COUNT = 8;
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gpregs, double *fpregs)
{

View File

@ -30,7 +30,7 @@ const uint32_t FPR_COUNT = 8;
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gpregs, double *fpregs)
{

View File

@ -30,7 +30,7 @@ const uint32_t FPR_COUNT = 8;
// The parameters are mapped into an array of type 'nsXPTCMiniVariant'
// and then the method gets called.
extern "C" nsresult
extern "C" nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gpregs, double *fpregs)
{

View File

@ -9,7 +9,7 @@
#include "xptcprivate.h"
#include "xptiprivate.h"
nsresult
nsresult ATTRIBUTE_USED
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

View File

@ -16,7 +16,7 @@
# error xptcstubs_x86_64_gnu.cpp being used unexpectedly
#endif
extern "C" nsresult
extern "C" nsresult __attribute__((__used__))
PrepareAndDispatch(nsXPTCStubBase * self, uint32_t methodIndex,
uint64_t * args, uint64_t * gprData, double *fprData)
{

View File

@ -58,4 +58,10 @@ public:
#undef STUB_ENTRY
#undef SENTINEL_ENTRY
#if defined(__clang__) || defined(__GNUC__)
#define ATTRIBUTE_USED __attribute__ ((__used__))
#else
#define ATTRIBUTE_USED
#endif
#endif /* xptcprivate_h___ */