Bug 550401: Do the __declspec import/export dance in mozalloc to avoid MSVC warnings. r=bsmedberg

This commit is contained in:
Chris Jones 2010-04-08 13:05:02 -05:00
parent 24c35dec9d
commit da9eaa48df
5 changed files with 22 additions and 6 deletions

View File

@ -48,6 +48,10 @@
#include <stddef.h> // for size_t
#include <stdlib.h> // for malloc, free
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#endif
// Make sure that "malloc" et al. resolve to their libc variants.
#define MOZALLOC_DONT_DEFINE_MACRO_WRAPPERS
#include "mozilla/mozalloc.h"

View File

@ -54,8 +54,11 @@
* I.e., we don't #include <stdlib.h> or <new> on purpose.
*/
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#if defined(MOZALLOC_EXPORT)
// do nothing: it's been defined to __declspec(dllexport) by
// mozalloc*.cpp on platforms where that's required
#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllimport)
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
/* Make sure symbols are still exported even if we're wrapped in a
* |visibility push(hidden)| blanket. */

View File

@ -46,6 +46,10 @@
# include <unistd.h> // for _exit
#endif
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#endif
#include "mozilla/mozalloc_oom.h"
static int gDummyCounter;

View File

@ -41,9 +41,11 @@
#ifndef mozilla_mozalloc_oom_h
#define mozilla_mozalloc_oom_h
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport)
#if defined(MOZALLOC_EXPORT)
// do nothing: it's been defined to __declspec(dllexport) by
// mozalloc*.cpp on platforms where that's required
#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllimport)
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
/* Make sure symbols are still exported even if we're wrapped in a
* |visibility push(hidden)| blanket. */

View File

@ -50,7 +50,10 @@
# if defined(__cplusplus)
# include NEW_H /* to give mozalloc std::bad_alloc */
# endif
# include <stdlib.h> /* to give mozalloc malloc/free decls */
/* include these to avoid the macro wrappers causing these headers to
* declare system functions with moz_ prefixes */
# include <stdlib.h>
# include <string.h>
# include "mozilla/mozalloc.h"
# include "mozilla/mozalloc_macro_wrappers.h"
#endif