Bug 807112 - change MOZ_EXPORT_API and MOZ_IMPORT_API to not take the type. r=Waldo.

This commit is contained in:
Rafael Ávila de Espíndola 2012-10-31 18:18:12 -04:00
parent cb08377fc6
commit 111917a5c3
9 changed files with 92 additions and 100 deletions

View File

@ -46,11 +46,11 @@
**
***********************************************************************/
#define JS_EXTERN_API(type) extern MOZ_EXPORT_API(type)
#define JS_EXPORT_API(type) MOZ_EXPORT_API(type)
#define JS_EXPORT_DATA(type) MOZ_EXPORT_DATA(type)
#define JS_IMPORT_API(type) MOZ_IMPORT_API(type)
#define JS_IMPORT_DATA(type) MOZ_IMPORT_DATA(type)
#define JS_EXTERN_API(type) extern MOZ_EXPORT type
#define JS_EXPORT_API(type) MOZ_EXPORT type
#define JS_EXPORT_DATA(type) MOZ_EXPORT type
#define JS_IMPORT_API(type) MOZ_IMPORT_API type
#define JS_IMPORT_DATA(type) MOZ_IMPORT_DATA type
/*
* The linkage of JS API functions differs depending on whether the file is
@ -62,11 +62,11 @@
# define JS_PUBLIC_API(t) t
# define JS_PUBLIC_DATA(t) t
#elif defined(EXPORT_JS_API) || defined(STATIC_EXPORTABLE_JS_API)
# define JS_PUBLIC_API(t) MOZ_EXPORT_API(t)
# define JS_PUBLIC_DATA(t) MOZ_EXPORT_DATA(t)
# define JS_PUBLIC_API(t) MOZ_EXPORT t
# define JS_PUBLIC_DATA(t) MOZ_EXPORT t
#else
# define JS_PUBLIC_API(t) MOZ_IMPORT_API(t)
# define JS_PUBLIC_DATA(t) MOZ_IMPORT_DATA(t)
# define JS_PUBLIC_API(t) MOZ_IMPORT_API t
# define JS_PUBLIC_DATA(t) MOZ_IMPORT_DATA t
#endif
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)

View File

@ -893,7 +893,7 @@ static bool CreateDecoder(PluginHost *aPluginHost, Decoder *aDecoder, const char
} // namespace OmxPlugin
// Export the manifest so MPAPI can find our entry points.
Manifest MOZ_EXPORT_DATA(MPAPI_MANIFEST) {
Manifest MOZ_EXPORT MPAPI_MANIFEST {
OmxPlugin::CanDecode,
OmxPlugin::CreateDecoder
};

View File

@ -19,111 +19,111 @@
#include "stagefright/OMXClient.h"
namespace android {
MOZ_EXPORT_API(void)
MOZ_EXPORT void
MediaBuffer::release()
{
}
MOZ_EXPORT_API(size_t)
MOZ_EXPORT size_t
MediaBuffer::range_offset() const
{
return 0;
}
MOZ_EXPORT_API(size_t)
MOZ_EXPORT size_t
MediaBuffer::range_length() const
{
return 0;
}
MOZ_EXPORT_API(sp<MetaData>)
MOZ_EXPORT sp<MetaData>
MediaBuffer::meta_data()
{
return 0;
}
MOZ_EXPORT_API(void*)
MOZ_EXPORT void*
MediaBuffer::data() const
{
return 0;
}
MOZ_EXPORT_API(size_t)
MOZ_EXPORT size_t
MediaBuffer::size() const
{
return 0;
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
MetaData::findInt32(uint32_t key, int32_t *value)
{
return false;
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
MetaData::findInt64(uint32_t key, int64_t *value)
{
return false;
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
MetaData::findPointer(uint32_t key, void **value)
{
return false;
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
MetaData::findCString(uint32_t key, const char **value)
{
return false;
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
MetaData::findRect(unsigned int key, int *cropLeft, int *cropTop,
int *cropRight, int *cropBottom)
{
abort();
}
MOZ_EXPORT_API(MediaSource::ReadOptions)::ReadOptions()
MOZ_EXPORT MediaSource::ReadOptions::ReadOptions()
{
}
MOZ_EXPORT_API(void)
MOZ_EXPORT void
MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode)
{
}
MOZ_EXPORT_API(bool)
MOZ_EXPORT bool
DataSource::getUInt16(off64_t offset, uint16_t *x)
{
return false;
}
MOZ_EXPORT_API(status_t)
MOZ_EXPORT status_t
DataSource::getSize(off64_t *size)
{
return 0;
}
MOZ_EXPORT_API(String8)
MOZ_EXPORT String8
DataSource::getMIMEType() const
{
return String8();
}
MOZ_EXPORT_API(void)
MOZ_EXPORT void
DataSource::RegisterDefaultSniffers()
{
}
MOZ_EXPORT_API(sp<MediaExtractor>)
MOZ_EXPORT sp<MediaExtractor>
MediaExtractor::Create(const sp<DataSource> &source, const char *mime)
{
return 0;
}
MOZ_EXPORT_API(sp<MediaSource>)
MOZ_EXPORT sp<MediaSource>
OMXCodec::Create(
const sp<IOMX> &omx,
const sp<MetaData> &meta, bool createEncoder,
@ -135,16 +135,16 @@ OMXCodec::Create(
return 0;
}
MOZ_EXPORT_API(OMXClient)::OMXClient()
MOZ_EXPORT OMXClient::OMXClient()
{
}
MOZ_EXPORT_API(status_t) OMXClient::connect()
MOZ_EXPORT status_t OMXClient::connect()
{
return OK;
}
MOZ_EXPORT_API(void) OMXClient::disconnect()
MOZ_EXPORT void OMXClient::disconnect()
{
}
@ -161,5 +161,5 @@ virtual ~UnknownDataSource() { }
UnknownDataSource foo;
MOZ_EXPORT_API(UnknownDataSource)::UnknownDataSource() { }
MOZ_EXPORT UnknownDataSource::UnknownDataSource() { }
}

View File

@ -9,52 +9,52 @@
#include "utils/String8.h"
namespace android {
MOZ_EXPORT_API(RefBase)::RefBase() : mRefs(0)
MOZ_EXPORT RefBase::RefBase() : mRefs(0)
{
}
MOZ_EXPORT_API(RefBase)::~RefBase()
MOZ_EXPORT RefBase::~RefBase()
{
}
MOZ_EXPORT_API(void) RefBase::incStrong(const void *id) const
MOZ_EXPORT void RefBase::incStrong(const void *id) const
{
}
MOZ_EXPORT_API(void) RefBase::decStrong(const void *id) const
MOZ_EXPORT void RefBase::decStrong(const void *id) const
{
}
MOZ_EXPORT_API(void) RefBase::onFirstRef()
MOZ_EXPORT void RefBase::onFirstRef()
{
}
MOZ_EXPORT_API(void) RefBase::onLastStrongRef(const void* id)
MOZ_EXPORT void RefBase::onLastStrongRef(const void* id)
{
}
MOZ_EXPORT_API(bool) RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
MOZ_EXPORT bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
{
return false;
}
MOZ_EXPORT_API(void) RefBase::onLastWeakRef(void const* id)
MOZ_EXPORT void RefBase::onLastWeakRef(void const* id)
{
}
MOZ_EXPORT_API(String16)::String16(char const*)
MOZ_EXPORT String16::String16(char const*)
{
}
MOZ_EXPORT_API(String16)::~String16()
MOZ_EXPORT String16::~String16()
{
}
MOZ_EXPORT_API(String8)::String8()
MOZ_EXPORT String8::String8()
{
}
MOZ_EXPORT_API(String8)::~String8()
MOZ_EXPORT String8::~String8()
{
}
}

View File

@ -20,49 +20,49 @@ void wrap(free)(void *);
#ifdef ANDROID
/* operator new(unsigned int) */
MOZ_EXPORT_API(void *)
MOZ_EXPORT void *
wrap(_Znwj)(unsigned int size)
{
return wrap(malloc)(size);
}
/* operator new[](unsigned int) */
MOZ_EXPORT_API(void *)
MOZ_EXPORT void *
wrap(_Znaj)(unsigned int size)
{
return wrap(malloc)(size);
}
/* operator delete(void*) */
MOZ_EXPORT_API(void)
MOZ_EXPORT void
wrap(_ZdlPv)(void *ptr)
{
wrap(free)(ptr);
}
/* operator delete[](void*) */
MOZ_EXPORT_API(void)
MOZ_EXPORT void
wrap(_ZdaPv)(void *ptr)
{
wrap(free)(ptr);
}
/*operator new(unsigned int, std::nothrow_t const&)*/
MOZ_EXPORT_API(void *)
MOZ_EXPORT void *
wrap(_ZnwjRKSt9nothrow_t)(unsigned int size)
{
return wrap(malloc)(size);
}
/*operator new[](unsigned int, std::nothrow_t const&)*/
MOZ_EXPORT_API(void *)
MOZ_EXPORT void *
wrap(_ZnajRKSt9nothrow_t)(unsigned int size)
{
return wrap(malloc)(size);
}
/* operator delete(void*, std::nothrow_t const&) */
MOZ_EXPORT_API(void)
MOZ_EXPORT void
wrap(_ZdlPvRKSt9nothrow_t)(void *ptr)
{
wrap(free)(ptr);
}
/* operator delete[](void*, std::nothrow_t const&) */
MOZ_EXPORT_API(void)
MOZ_EXPORT void
wrap(_ZdaPvRKSt9nothrow_t)(void *ptr)
{
wrap(free)(ptr);
@ -70,7 +70,7 @@ wrap(_ZdaPvRKSt9nothrow_t)(void *ptr)
#endif
#ifdef wrap
MOZ_EXPORT_API(char *)
MOZ_EXPORT char *
wrap(strndup)(const char *src, size_t len)
{
char* dst = (char*) wrap(malloc)(len + 1);
@ -79,7 +79,7 @@ wrap(strndup)(const char *src, size_t len)
return dst;
}
MOZ_EXPORT_API(char *)
MOZ_EXPORT char *
wrap(strdup)(const char *src)
{
size_t len = strlen(src);
@ -127,7 +127,7 @@ wrap(wcsdup)(const wchar_t *src)
#endif
/* Override some jemalloc defaults */
MOZ_EXPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
MOZ_EXPORT const char * wrap(malloc_conf) = "narenas:1,lg_chunk:20";
#ifdef ANDROID
#include <android/log.h>

View File

@ -31,14 +31,14 @@
wrap(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
} while (0)
MOZ_IMPORT_API(int)
MOZ_IMPORT_API int
wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
MOZ_IMPORT_API(int)
MOZ_IMPORT_API int
wrap(mallctlnametomib)(const char *name, size_t *mibp, size_t *miblenp);
MOZ_IMPORT_API(int)
MOZ_IMPORT_API int
wrap(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
MOZ_EXPORT_API(void)
MOZ_EXPORT void
jemalloc_stats(jemalloc_stats_t *stats)
{
unsigned narenas;

View File

@ -59,7 +59,7 @@ void jemalloc_stats(jemalloc_stats_t *stats);
__attribute__((weak))
#endif
#if defined(MOZ_JEMALLOC)
MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
MOZ_IMPORT_API int wrap(nallocm)(size_t *rsize, size_t size, int flags);
#else
size_t je_malloc_good_size(size_t size);
#endif

View File

@ -66,7 +66,7 @@ namespace detail {
* For more details, and examples of using these macros, see
* https://developer.mozilla.org/en/Using_RAII_classes_in_Mozilla
*/
class MOZ_EXPORT_API(GuardObjectNotifier)
class MOZ_EXPORT GuardObjectNotifier
{
private:
bool* statementDone;
@ -83,7 +83,7 @@ class MOZ_EXPORT_API(GuardObjectNotifier)
}
};
class MOZ_EXPORT_API(GuardObjectNotificationReceiver)
class MOZ_EXPORT GuardObjectNotificationReceiver
{
private:
bool statementDone;

View File

@ -27,78 +27,70 @@
/* Implement compiler and linker macros needed for APIs. */
/*
* MOZ_EXPORT_API is used to declare and define a method which is externally
* MOZ_EXPORT is used to declare and define a symbol or type which is externally
* visible to users of the current library. It encapsulates various decorations
* needed to properly export the method's symbol. MOZ_EXPORT_DATA serves the
* same purpose for data.
* needed to properly export the method's symbol.
*
* api.h:
* extern MOZ_EXPORT_API(int) MeaningOfLife(void);
* extern MOZ_EXPORT_DATA(int) LuggageCombination;
* extern MOZ_EXPORT int MeaningOfLife(void);
* extern MOZ_EXPORT int LuggageCombination;
*
* api.c:
* MOZ_EXPORT_API(int) MeaningOfLife(void) { return 42; }
* MOZ_EXPORT_DATA(int) LuggageCombination = 12345;
* int MeaningOfLife(void) { return 42; }
* int LuggageCombination = 12345;
*
* If you are merely sharing a method across files, just use plain |extern|.
* These macros are designed for use by library interfaces -- not for normal
* methods or data used cross-file.
*/
#if defined(WIN32) || defined(XP_OS2)
# define MOZ_EXPORT_DIRECTIVE __declspec(dllexport)
# define MOZ_EXPORT __declspec(dllexport)
#else /* Unix */
# ifdef HAVE_VISIBILITY_ATTRIBUTE
# define MOZ_EXTERNAL_VIS __attribute__((visibility("default")))
# define MOZ_EXPORT __attribute__((visibility("default")))
# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# define MOZ_EXTERNAL_VIS __global
# define MOZ_EXPORT __global
# else
# define MOZ_EXTERNAL_VIS
# define MOZ_EXPORT /* nothing */
# endif
# define MOZ_EXPORT_DIRECTIVE MOZ_EXTERNAL_VIS
#endif
#define MOZ_EXPORT_API(type) MOZ_EXPORT_DIRECTIVE type
#define MOZ_EXPORT_DATA(type) MOZ_EXPORT_DIRECTIVE type
/*
* Whereas implementers use MOZ_EXPORT_API and MOZ_EXPORT_DATA to declare and
* define library symbols, users use MOZ_IMPORT_API and MOZ_IMPORT_DATA to
* access them. Most often the implementer of the library will expose an API
* macro which expands to either the export or import version of the macro,
* depending upon the compilation mode.
* Whereas implementers use MOZ_EXPORT to declare and define library symbols,
* users use MOZ_IMPORT_API and MOZ_IMPORT_DATA to access them. Most often the
* implementer of the library will expose an API macro which expands to either
* the export or import version of the macro, depending upon the compilation
* mode.
*/
#ifdef _WIN32
# if defined(__MWERKS__)
# define MOZ_IMPORT_API_DIRECTIVE /* nothing */
# define MOZ_IMPORT_API /* nothing */
# else
# define MOZ_IMPORT_API_DIRECTIVE __declspec(dllimport)
# define MOZ_IMPORT_API __declspec(dllimport)
# endif
#elif defined(XP_OS2)
# define MOZ_IMPORT_API_DIRECTIVE __declspec(dllimport)
# define MOZ_IMPORT_API __declspec(dllimport)
#else
# define MOZ_IMPORT_API_DIRECTIVE MOZ_EXPORT_DIRECTIVE
# define MOZ_IMPORT_API MOZ_EXPORT
#endif
#define MOZ_IMPORT_API(x) MOZ_IMPORT_API_DIRECTIVE x
#if defined(_WIN32) && !defined(__MWERKS__)
# define MOZ_IMPORT_DATA_DIRECTIVE __declspec(dllimport)
# define MOZ_IMPORT_DATA __declspec(dllimport)
#elif defined(XP_OS2)
# define MOZ_IMPORT_DATA_DIRECTIVE __declspec(dllimport)
# define MOZ_IMPORT_DATA __declspec(dllimport)
#else
# define MOZ_IMPORT_DATA_DIRECTIVE MOZ_EXPORT_DIRECTIVE
# define MOZ_IMPORT_DATA MOZ_EXPORT
#endif
#define MOZ_IMPORT_DATA(x) MOZ_IMPORT_DATA_DIRECTIVE x
/*
* Consistent with the above comment, the MFBT_API and MFBT_DATA macros expose
* export mfbt declarations when building mfbt, and they expose import mfbt
* declarations when using mfbt.
*/
#if defined(IMPL_MFBT)
# define MFBT_API MOZ_EXPORT_DIRECTIVE
# define MFBT_DATA MOZ_EXPORT_DIRECTIVE
# define MFBT_API MOZ_EXPORT
# define MFBT_DATA MOZ_EXPORT
#else
/*
* On linux mozglue is linked in the program and we link libxul.so with
@ -108,11 +100,11 @@
* macros to exploit this.
*/
# if defined(MOZ_GLUE_IN_PROGRAM)
# define MFBT_API __attribute__((weak)) MOZ_IMPORT_API_DIRECTIVE
# define MFBT_DATA __attribute__((weak)) MOZ_IMPORT_DATA_DIRECTIVE
# define MFBT_API __attribute__((weak)) MOZ_IMPORT_API
# define MFBT_DATA __attribute__((weak)) MOZ_IMPORT_DATA
# else
# define MFBT_API MOZ_IMPORT_API_DIRECTIVE
# define MFBT_DATA MOZ_IMPORT_DATA_DIRECTIVE
# define MFBT_API MOZ_IMPORT_API
# define MFBT_DATA MOZ_IMPORT_DATA
# endif
#endif
@ -125,7 +117,7 @@
*
* MOZ_BEGIN_EXTERN_C
*
* extern MOZ_EXPORT_API(int) MostRandomNumber(void);
* extern MOZ_EXPORT int MostRandomNumber(void);
* ...other declarations...
*
* MOZ_END_EXTERN_C