mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 415274: Patch from Mike Moening to allow buiding SpiderMonkey as a static library. r=myself, a1.9=brendan
This commit is contained in:
parent
65b1260fd4
commit
4b387e5fd5
@ -5698,38 +5698,16 @@ JS_SetGCZeal(JSContext *cx, uint8 zeal)
|
|||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if !defined(STATIC_JS_API) && defined(XP_WIN)
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/*
|
|
||||||
* Initialization routine for the JS DLL...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global Instance handle...
|
* Initialization routine for the JS DLL.
|
||||||
* In Win32 this is the module handle of the DLL.
|
|
||||||
*
|
|
||||||
* In Win16 this is the instance handle of the application
|
|
||||||
* which loaded the DLL.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !_WIN32 */
|
#endif
|
||||||
|
|
||||||
int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg,
|
|
||||||
WORD cbHeapSize, LPSTR lpszCmdLine )
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL CALLBACK __loadds WEP(BOOL fSystemExit)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !_WIN32 */
|
|
||||||
#endif /* XP_WIN */
|
|
||||||
|
185
js/src/jstypes.h
185
js/src/jstypes.h
@ -77,107 +77,96 @@
|
|||||||
**
|
**
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* These also work for __MWERKS__ */
|
|
||||||
#define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
|
|
||||||
#define JS_EXPORT_API(__type) __declspec(dllexport) __type
|
|
||||||
#define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
|
||||||
#define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
|
|
||||||
|
|
||||||
#define JS_DLL_CALLBACK
|
/* These also work for __MWERKS__ */
|
||||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
|
||||||
|
# define JS_EXPORT_API(__type) __declspec(dllexport) __type
|
||||||
|
# define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
||||||
|
# define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
|
||||||
|
|
||||||
|
# define JS_DLL_CALLBACK
|
||||||
|
# define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||||
|
|
||||||
#elif defined(XP_OS2) && defined(__declspec)
|
#elif defined(XP_OS2) && defined(__declspec)
|
||||||
|
|
||||||
#define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
|
# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
|
||||||
#define JS_EXPORT_API(__type) __declspec(dllexport) __type
|
# define JS_EXPORT_API(__type) __declspec(dllexport) __type
|
||||||
#define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
# define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
||||||
#define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
|
# define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
|
||||||
|
|
||||||
#define JS_DLL_CALLBACK
|
# define JS_DLL_CALLBACK
|
||||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
# define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||||
|
|
||||||
#elif defined(WIN16)
|
|
||||||
|
|
||||||
#ifdef _WINDLL
|
|
||||||
#define JS_EXTERN_API(__type) extern __type _cdecl _export _loadds
|
|
||||||
#define JS_EXPORT_API(__type) __type _cdecl _export _loadds
|
|
||||||
#define JS_EXTERN_DATA(__type) extern __type _export
|
|
||||||
#define JS_EXPORT_DATA(__type) __type _export
|
|
||||||
|
|
||||||
#define JS_DLL_CALLBACK __cdecl __loadds
|
|
||||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x CALLBACK
|
|
||||||
|
|
||||||
#else /* this must be .EXE */
|
|
||||||
#define JS_EXTERN_API(__type) extern __type _cdecl _export
|
|
||||||
#define JS_EXPORT_API(__type) __type _cdecl _export
|
|
||||||
#define JS_EXTERN_DATA(__type) extern __type _export
|
|
||||||
#define JS_EXPORT_DATA(__type) __type _export
|
|
||||||
|
|
||||||
#define JS_DLL_CALLBACK __cdecl __loadds
|
|
||||||
#define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK
|
|
||||||
#endif /* _WINDLL */
|
|
||||||
|
|
||||||
#else /* Unix */
|
#else /* Unix */
|
||||||
|
|
||||||
#ifdef HAVE_VISIBILITY_ATTRIBUTE
|
# ifdef HAVE_VISIBILITY_ATTRIBUTE
|
||||||
#define JS_EXTERNAL_VIS __attribute__((visibility ("default")))
|
# define JS_EXTERNAL_VIS __attribute__((visibility ("default")))
|
||||||
#else
|
# else
|
||||||
#define JS_EXTERNAL_VIS
|
# define JS_EXTERNAL_VIS
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type
|
# define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type
|
||||||
#define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type
|
# define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type
|
||||||
#define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type
|
# define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type
|
||||||
#define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type
|
# define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type
|
||||||
|
|
||||||
#define JS_DLL_CALLBACK
|
# define JS_DLL_CALLBACK
|
||||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
# define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# if defined(__MWERKS__) || defined(__GNUC__)
|
# if defined(__MWERKS__) || defined(__GNUC__)
|
||||||
# define JS_IMPORT_API(__x) __x
|
# define JS_IMPORT_API(__x) __x
|
||||||
# else
|
# else
|
||||||
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
|
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
|
||||||
# endif
|
# endif
|
||||||
#elif defined(XP_OS2) && defined(__declspec)
|
#elif defined(XP_OS2) && defined(__declspec)
|
||||||
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
|
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
|
||||||
#else
|
#else
|
||||||
# define JS_IMPORT_API(__x) JS_EXPORT_API (__x)
|
# define JS_IMPORT_API(__x) JS_EXPORT_API (__x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__MWERKS__)
|
#if defined(_WIN32) && !defined(__MWERKS__)
|
||||||
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
|
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
|
||||||
#elif defined(XP_OS2) && defined(__declspec)
|
#elif defined(XP_OS2) && defined(__declspec)
|
||||||
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
|
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
|
||||||
#else
|
#else
|
||||||
# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x)
|
# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The linkage of JS API functions differs depending on whether the file is
|
* The linkage of JS API functions differs depending on whether the file is
|
||||||
* used within the JS library or not. Any source file within the JS
|
* used within the JS library or not. Any source file within the JS
|
||||||
* interpreter should define EXPORT_JS_API whereas any client of the library
|
* interpreter should define EXPORT_JS_API whereas any client of the library
|
||||||
* should not.
|
* should not. STATIC_JS_API is used to build JS as a static library.
|
||||||
*/
|
*/
|
||||||
#ifdef EXPORT_JS_API
|
#if defined(STATIC_JS_API)
|
||||||
#define JS_PUBLIC_API(t) JS_EXPORT_API(t)
|
|
||||||
#define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
|
# define JS_PUBLIC_API(t) t
|
||||||
|
# define JS_PUBLIC_DATA(t) t
|
||||||
|
|
||||||
|
#elif defined(EXPORT_JS_API)
|
||||||
|
|
||||||
|
# define JS_PUBLIC_API(t) JS_EXPORT_API(t)
|
||||||
|
# define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define JS_PUBLIC_API(t) JS_IMPORT_API(t)
|
|
||||||
#define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
|
# define JS_PUBLIC_API(t) JS_IMPORT_API(t)
|
||||||
|
# define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)
|
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)
|
||||||
#define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
|
#define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define JS_INLINE __inline
|
# define JS_INLINE __inline
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
# define JS_INLINE
|
# define JS_INLINE
|
||||||
#else
|
#else
|
||||||
# define JS_INLINE
|
# define JS_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -204,11 +193,15 @@
|
|||||||
** Macro shorthands for conditional C++ extern block delimiters.
|
** Macro shorthands for conditional C++ extern block delimiters.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define JS_BEGIN_EXTERN_C extern "C" {
|
|
||||||
#define JS_END_EXTERN_C }
|
# define JS_BEGIN_EXTERN_C extern "C" {
|
||||||
|
# define JS_END_EXTERN_C }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define JS_BEGIN_EXTERN_C
|
|
||||||
#define JS_END_EXTERN_C
|
# define JS_BEGIN_EXTERN_C
|
||||||
|
# define JS_END_EXTERN_C
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@ -247,12 +240,12 @@
|
|||||||
#define JS_MAX(x,y) ((x)>(y)?(x):(y))
|
#define JS_MAX(x,y) ((x)>(y)?(x):(y))
|
||||||
|
|
||||||
#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE)
|
#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE)
|
||||||
# include "jscpucfg.h" /* Use standard Mac or Windows configuration */
|
# include "jscpucfg.h" /* Use standard Mac or Windows configuration */
|
||||||
#elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE)
|
#elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE)
|
||||||
# include "jsautocfg.h" /* Use auto-detected configuration */
|
# include "jsautocfg.h" /* Use auto-detected configuration */
|
||||||
# include "jsosdep.h" /* ...and platform-specific flags */
|
# include "jsosdep.h" /* ...and platform-specific flags */
|
||||||
#else
|
#else
|
||||||
# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX"
|
# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
JS_BEGIN_EXTERN_C
|
JS_BEGIN_EXTERN_C
|
||||||
@ -268,7 +261,7 @@ JS_BEGIN_EXTERN_C
|
|||||||
typedef unsigned char JSUint8;
|
typedef unsigned char JSUint8;
|
||||||
typedef signed char JSInt8;
|
typedef signed char JSInt8;
|
||||||
#else
|
#else
|
||||||
#error No suitable type for JSInt8/JSUint8
|
# error No suitable type for JSInt8/JSUint8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -281,7 +274,7 @@ typedef signed char JSInt8;
|
|||||||
typedef unsigned short JSUint16;
|
typedef unsigned short JSUint16;
|
||||||
typedef short JSInt16;
|
typedef short JSInt16;
|
||||||
#else
|
#else
|
||||||
#error No suitable type for JSInt16/JSUint16
|
# error No suitable type for JSInt16/JSUint16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -293,15 +286,15 @@ typedef short JSInt16;
|
|||||||
#if JS_BYTES_PER_INT == 4
|
#if JS_BYTES_PER_INT == 4
|
||||||
typedef unsigned int JSUint32;
|
typedef unsigned int JSUint32;
|
||||||
typedef int JSInt32;
|
typedef int JSInt32;
|
||||||
#define JS_INT32(x) x
|
# define JS_INT32(x) x
|
||||||
#define JS_UINT32(x) x ## U
|
# define JS_UINT32(x) x ## U
|
||||||
#elif JS_BYTES_PER_LONG == 4
|
#elif JS_BYTES_PER_LONG == 4
|
||||||
typedef unsigned long JSUint32;
|
typedef unsigned long JSUint32;
|
||||||
typedef long JSInt32;
|
typedef long JSInt32;
|
||||||
#define JS_INT32(x) x ## L
|
# define JS_INT32(x) x ## L
|
||||||
#define JS_UINT32(x) x ## UL
|
# define JS_UINT32(x) x ## UL
|
||||||
#else
|
#else
|
||||||
#error No suitable type for JSInt32/JSUint32
|
# error No suitable type for JSInt32/JSUint32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -315,28 +308,32 @@ typedef long JSInt32;
|
|||||||
** the JSLL_ macros (see jslong.h).
|
** the JSLL_ macros (see jslong.h).
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef JS_HAVE_LONG_LONG
|
#ifdef JS_HAVE_LONG_LONG
|
||||||
#if JS_BYTES_PER_LONG == 8
|
|
||||||
|
# if JS_BYTES_PER_LONG == 8
|
||||||
typedef long JSInt64;
|
typedef long JSInt64;
|
||||||
typedef unsigned long JSUint64;
|
typedef unsigned long JSUint64;
|
||||||
#elif defined(WIN16)
|
# elif defined(WIN16)
|
||||||
typedef __int64 JSInt64;
|
typedef __int64 JSInt64;
|
||||||
typedef unsigned __int64 JSUint64;
|
typedef unsigned __int64 JSUint64;
|
||||||
#elif defined(WIN32) && !defined(__GNUC__)
|
# elif defined(WIN32) && !defined(__GNUC__)
|
||||||
typedef __int64 JSInt64;
|
typedef __int64 JSInt64;
|
||||||
typedef unsigned __int64 JSUint64;
|
typedef unsigned __int64 JSUint64;
|
||||||
#else
|
# else
|
||||||
typedef long long JSInt64;
|
typedef long long JSInt64;
|
||||||
typedef unsigned long long JSUint64;
|
typedef unsigned long long JSUint64;
|
||||||
#endif /* JS_BYTES_PER_LONG == 8 */
|
# endif /* JS_BYTES_PER_LONG == 8 */
|
||||||
|
|
||||||
#else /* !JS_HAVE_LONG_LONG */
|
#else /* !JS_HAVE_LONG_LONG */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#ifdef IS_LITTLE_ENDIAN
|
# ifdef IS_LITTLE_ENDIAN
|
||||||
JSUint32 lo, hi;
|
JSUint32 lo, hi;
|
||||||
#else
|
# else
|
||||||
JSUint32 hi, lo;
|
JSUint32 hi, lo;
|
||||||
#endif
|
#endif
|
||||||
} JSInt64;
|
} JSInt64;
|
||||||
typedef JSInt64 JSUint64;
|
typedef JSInt64 JSUint64;
|
||||||
|
|
||||||
#endif /* !JS_HAVE_LONG_LONG */
|
#endif /* !JS_HAVE_LONG_LONG */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -352,7 +349,7 @@ typedef JSInt64 JSUint64;
|
|||||||
typedef int JSIntn;
|
typedef int JSIntn;
|
||||||
typedef unsigned int JSUintn;
|
typedef unsigned int JSUintn;
|
||||||
#else
|
#else
|
||||||
#error 'sizeof(int)' not sufficient for platform use
|
# error 'sizeof(int)' not sufficient for platform use
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -439,11 +436,15 @@ typedef unsigned long JSUword;
|
|||||||
**
|
**
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||||
#define JS_LIKELY(x) (__builtin_expect((x), 1))
|
|
||||||
#define JS_UNLIKELY(x) (__builtin_expect((x), 0))
|
# define JS_LIKELY(x) (__builtin_expect((x), 1))
|
||||||
|
# define JS_UNLIKELY(x) (__builtin_expect((x), 0))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define JS_LIKELY(x) (x)
|
|
||||||
#define JS_UNLIKELY(x) (x)
|
# define JS_LIKELY(x) (x)
|
||||||
|
# define JS_UNLIKELY(x) (x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user