2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-08-18 13:46:39 +00:00
|
|
|
|
1999-05-18 21:43:13 +00:00
|
|
|
#ifndef nscore_h___
|
|
|
|
#define nscore_h___
|
|
|
|
|
2003-04-04 04:50:58 +00:00
|
|
|
/**
|
2009-09-12 16:49:24 +00:00
|
|
|
* Make sure that we have the proper platform specific
|
2003-04-04 04:50:58 +00:00
|
|
|
* c++ definitions needed by nscore.h
|
|
|
|
*/
|
2003-06-27 04:12:16 +00:00
|
|
|
#ifndef _XPCOM_CONFIG_H_
|
|
|
|
#include "xpcom-config.h"
|
2003-04-04 04:50:58 +00:00
|
|
|
#endif
|
|
|
|
|
2010-03-04 05:02:58 +00:00
|
|
|
/* Definitions of functions and operators that allocate memory. */
|
|
|
|
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
|
|
|
|
# include "mozilla/mozalloc.h"
|
|
|
|
#endif
|
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/**
|
2012-09-06 21:54:59 +00:00
|
|
|
* Incorporate the integer data types which XPCOM uses.
|
2001-09-27 03:43:00 +00:00
|
|
|
*/
|
2013-07-30 14:25:31 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
2001-09-27 03:43:00 +00:00
|
|
|
|
2014-01-02 23:27:41 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
# include "mozilla/NullPtr.h"
|
|
|
|
#endif
|
2012-09-01 20:16:17 +00:00
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/* Core XPCOM declarations. */
|
|
|
|
|
1999-05-18 21:43:13 +00:00
|
|
|
/*----------------------------------------------------------------------*/
|
|
|
|
/* Import/export defines */
|
|
|
|
|
2004-02-03 08:32:33 +00:00
|
|
|
/**
|
|
|
|
* Using the visibility("hidden") attribute allows the compiler to use
|
|
|
|
* PC-relative addressing to call this function. If a function does not
|
|
|
|
* access any global data, and does not call any methods which are not either
|
|
|
|
* file-local or hidden, then on ELF systems we avoid loading the address of
|
|
|
|
* the PLT into a register at the start of the function, which reduces code
|
|
|
|
* size and frees up a register for general use.
|
|
|
|
*
|
|
|
|
* As a general rule, this should be used for any non-exported symbol
|
|
|
|
* (including virtual method implementations). NS_IMETHOD uses this by
|
|
|
|
* default; if you need to have your NS_IMETHOD functions exported, you can
|
|
|
|
* wrap your class as follows:
|
|
|
|
*
|
|
|
|
* #undef IMETHOD_VISIBILITY
|
2004-02-04 04:55:57 +00:00
|
|
|
* #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
|
|
|
|
*
|
2004-02-03 08:32:33 +00:00
|
|
|
* class Foo {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* #undef IMETHOD_VISIBILITY
|
2004-02-04 04:55:57 +00:00
|
|
|
* #define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
|
2004-02-03 08:32:33 +00:00
|
|
|
*
|
|
|
|
* Don't forget to change the visibility back to hidden before the end
|
|
|
|
* of a header!
|
2004-02-04 04:55:57 +00:00
|
|
|
*
|
|
|
|
* Other examples:
|
|
|
|
*
|
|
|
|
* NS_HIDDEN_(int) someMethod();
|
|
|
|
* SomeCtor() NS_HIDDEN;
|
2004-02-03 08:32:33 +00:00
|
|
|
*/
|
|
|
|
|
2004-12-15 05:52:44 +00:00
|
|
|
#ifdef HAVE_VISIBILITY_HIDDEN_ATTRIBUTE
|
2004-02-04 04:55:57 +00:00
|
|
|
#define NS_VISIBILITY_HIDDEN __attribute__ ((visibility ("hidden")))
|
2004-02-03 08:32:33 +00:00
|
|
|
#else
|
2004-02-04 04:55:57 +00:00
|
|
|
#define NS_VISIBILITY_HIDDEN
|
2004-12-15 05:52:44 +00:00
|
|
|
#endif
|
2004-02-04 04:55:57 +00:00
|
|
|
|
2005-11-02 14:14:18 +00:00
|
|
|
#if defined(HAVE_VISIBILITY_ATTRIBUTE)
|
2004-12-15 05:52:44 +00:00
|
|
|
#define NS_VISIBILITY_DEFAULT __attribute__ ((visibility ("default")))
|
2008-09-08 06:21:07 +00:00
|
|
|
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
|
|
|
#define NS_VISIBILITY_DEFAULT __global
|
2004-12-15 05:52:44 +00:00
|
|
|
#else
|
|
|
|
#define NS_VISIBILITY_DEFAULT
|
2004-02-03 08:32:33 +00:00
|
|
|
#endif
|
|
|
|
|
2004-12-15 05:52:44 +00:00
|
|
|
#define NS_HIDDEN_(type) NS_VISIBILITY_HIDDEN type
|
|
|
|
#define NS_EXTERNAL_VIS_(type) NS_VISIBILITY_DEFAULT type
|
|
|
|
|
2004-02-04 04:55:57 +00:00
|
|
|
#define NS_HIDDEN NS_VISIBILITY_HIDDEN
|
2004-12-15 05:52:44 +00:00
|
|
|
#define NS_EXTERNAL_VIS NS_VISIBILITY_DEFAULT
|
2004-02-03 08:32:33 +00:00
|
|
|
|
|
|
|
#undef IMETHOD_VISIBILITY
|
2004-02-04 04:55:57 +00:00
|
|
|
#define IMETHOD_VISIBILITY NS_VISIBILITY_HIDDEN
|
2004-02-03 08:32:33 +00:00
|
|
|
|
2004-07-14 22:14:34 +00:00
|
|
|
/**
|
|
|
|
* Mark a function as using a potentially non-standard function calling
|
|
|
|
* convention. This can be used on functions that are called very
|
|
|
|
* frequently, to reduce the overhead of the function call. It is still worth
|
|
|
|
* using the macro for C++ functions which take no parameters since it allows
|
|
|
|
* passing |this| in a register.
|
|
|
|
*
|
|
|
|
* - Do not use this on any scriptable interface method since xptcall won't be
|
|
|
|
* aware of the different calling convention.
|
|
|
|
* - This must appear on the declaration, not the definition.
|
|
|
|
* - Adding this to a public function _will_ break binary compatibility.
|
|
|
|
* - This may be used on virtual functions but you must ensure it is applied
|
|
|
|
* to all implementations - the compiler will _not_ warn but it will crash.
|
2012-07-05 21:38:30 +00:00
|
|
|
* - This has no effect for functions which take a variable number of
|
|
|
|
* arguments.
|
2005-11-10 14:43:22 +00:00
|
|
|
* - __fastcall on windows should not be applied to class
|
|
|
|
* constructors/destructors - use the NS_CONSTRUCTOR_FASTCALL macro for
|
|
|
|
* constructors/destructors.
|
2004-07-14 22:14:34 +00:00
|
|
|
*
|
|
|
|
* Examples: int NS_FASTCALL func1(char *foo);
|
|
|
|
* NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
|
|
|
|
*/
|
|
|
|
|
2012-12-18 18:22:28 +00:00
|
|
|
#if defined(__i386__) && defined(__GNUC__) && !defined(XP_OS2)
|
2004-07-14 22:14:34 +00:00
|
|
|
#define NS_FASTCALL __attribute__ ((regparm (3), stdcall))
|
2005-11-10 14:43:22 +00:00
|
|
|
#define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall))
|
2010-06-14 10:12:48 +00:00
|
|
|
#elif defined(XP_WIN) && !defined(_WIN64)
|
2005-11-10 14:43:22 +00:00
|
|
|
#define NS_FASTCALL __fastcall
|
|
|
|
#define NS_CONSTRUCTOR_FASTCALL
|
2004-07-14 22:14:34 +00:00
|
|
|
#else
|
|
|
|
#define NS_FASTCALL
|
2005-11-10 14:43:22 +00:00
|
|
|
#define NS_CONSTRUCTOR_FASTCALL
|
2004-07-14 22:14:34 +00:00
|
|
|
#endif
|
|
|
|
|
2011-12-21 05:09:17 +00:00
|
|
|
#ifdef XP_WIN
|
2001-09-27 03:43:00 +00:00
|
|
|
|
2003-06-24 22:12:37 +00:00
|
|
|
#define NS_IMPORT __declspec(dllimport)
|
2005-11-08 18:17:49 +00:00
|
|
|
#define NS_IMPORT_(type) __declspec(dllimport) type __stdcall
|
2003-06-24 22:12:37 +00:00
|
|
|
#define NS_EXPORT __declspec(dllexport)
|
2005-11-08 18:17:49 +00:00
|
|
|
#define NS_EXPORT_(type) __declspec(dllexport) type __stdcall
|
2001-09-27 03:43:00 +00:00
|
|
|
#define NS_IMETHOD_(type) virtual type __stdcall
|
|
|
|
#define NS_IMETHODIMP_(type) type __stdcall
|
|
|
|
#define NS_METHOD_(type) type __stdcall
|
|
|
|
#define NS_CALLBACK_(_type, _name) _type (__stdcall * _name)
|
2013-07-18 14:17:13 +00:00
|
|
|
#ifndef _WIN64
|
|
|
|
// Win64 has only one calling convention. __stdcall will be ignored by the compiler.
|
2013-07-21 04:59:05 +00:00
|
|
|
#define NS_STDCALL __stdcall
|
2013-07-17 02:01:50 +00:00
|
|
|
#define NS_HAVE_STDCALL
|
2013-07-21 04:59:05 +00:00
|
|
|
#else
|
|
|
|
#define NS_STDCALL
|
2013-07-18 14:17:13 +00:00
|
|
|
#endif
|
2005-11-08 18:17:49 +00:00
|
|
|
#define NS_FROZENCALL __cdecl
|
2001-09-27 03:43:00 +00:00
|
|
|
|
2005-04-28 20:57:42 +00:00
|
|
|
/*
|
|
|
|
These are needed to mark static members in exported classes, due to
|
|
|
|
gcc bug XXX insert bug# here.
|
|
|
|
*/
|
2004-12-15 05:52:44 +00:00
|
|
|
|
|
|
|
#define NS_EXPORT_STATIC_MEMBER_(type) type
|
|
|
|
#define NS_IMPORT_STATIC_MEMBER_(type) type
|
|
|
|
|
2010-11-09 10:13:03 +00:00
|
|
|
#elif defined(XP_OS2)
|
2006-03-08 19:56:32 +00:00
|
|
|
|
|
|
|
#define NS_IMPORT __declspec(dllimport)
|
|
|
|
#define NS_IMPORT_(type) type __declspec(dllimport)
|
|
|
|
#define NS_EXPORT __declspec(dllexport)
|
|
|
|
#define NS_EXPORT_(type) type __declspec(dllexport)
|
|
|
|
#define NS_IMETHOD_(type) virtual type
|
|
|
|
#define NS_IMETHODIMP_(type) type
|
|
|
|
#define NS_METHOD_(type) type
|
|
|
|
#define NS_CALLBACK_(_type, _name) _type (* _name)
|
|
|
|
#define NS_STDCALL
|
|
|
|
#define NS_FROZENCALL
|
|
|
|
#define NS_EXPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
|
|
|
|
#define NS_IMPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
|
|
|
|
|
1999-05-18 21:43:13 +00:00
|
|
|
#else
|
|
|
|
|
2004-12-15 05:52:44 +00:00
|
|
|
#define NS_IMPORT NS_EXTERNAL_VIS
|
|
|
|
#define NS_IMPORT_(type) NS_EXTERNAL_VIS_(type)
|
|
|
|
#define NS_EXPORT NS_EXTERNAL_VIS
|
|
|
|
#define NS_EXPORT_(type) NS_EXTERNAL_VIS_(type)
|
2011-08-30 18:22:00 +00:00
|
|
|
#define NS_IMETHOD_(type) virtual IMETHOD_VISIBILITY type
|
2001-09-27 03:43:00 +00:00
|
|
|
#define NS_IMETHODIMP_(type) type
|
|
|
|
#define NS_METHOD_(type) type
|
|
|
|
#define NS_CALLBACK_(_type, _name) _type (* _name)
|
2003-03-07 06:07:56 +00:00
|
|
|
#define NS_STDCALL
|
2005-11-08 18:17:49 +00:00
|
|
|
#define NS_FROZENCALL
|
2004-12-15 05:52:44 +00:00
|
|
|
#define NS_EXPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
|
|
|
|
#define NS_IMPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
|
|
|
|
|
2003-03-07 06:07:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2003-09-15 04:20:20 +00:00
|
|
|
* Macro for creating typedefs for pointer-to-member types which are
|
|
|
|
* declared with stdcall. It is important to use this for any type which is
|
|
|
|
* declared as stdcall (i.e. NS_IMETHOD). For example, instead of writing:
|
|
|
|
*
|
|
|
|
* typedef nsresult (nsIFoo::*someType)(nsISupports* arg);
|
|
|
|
*
|
|
|
|
* you should write:
|
|
|
|
*
|
|
|
|
* typedef
|
|
|
|
* NS_STDCALL_FUNCPROTO(nsresult, someType, nsIFoo, typeFunc, (nsISupports*));
|
|
|
|
*
|
|
|
|
* where nsIFoo::typeFunc is any method declared as
|
|
|
|
* NS_IMETHOD typeFunc(nsISupports*);
|
|
|
|
*
|
|
|
|
* XXX this can be simplified to always use the non-typeof implementation
|
|
|
|
* when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
|
2003-03-07 06:07:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
2003-09-15 04:20:20 +00:00
|
|
|
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
|
|
|
|
typeof(&class::func) name
|
2003-03-07 06:07:56 +00:00
|
|
|
#else
|
2003-09-15 04:20:20 +00:00
|
|
|
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
|
|
|
|
ret (NS_STDCALL class::*name) args
|
1999-05-18 21:43:13 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-12 11:00:24 +00:00
|
|
|
/**
|
|
|
|
* Deprecated declarations.
|
|
|
|
*/
|
2012-12-18 18:22:28 +00:00
|
|
|
#ifdef __GNUC__
|
2011-06-08 07:34:02 +00:00
|
|
|
# define MOZ_DEPRECATED __attribute__((deprecated))
|
2012-01-05 07:52:22 +00:00
|
|
|
#elif defined(_MSC_VER)
|
2011-06-08 07:34:02 +00:00
|
|
|
# define MOZ_DEPRECATED __declspec(deprecated)
|
2008-03-12 11:00:24 +00:00
|
|
|
#else
|
2011-06-08 07:34:02 +00:00
|
|
|
# define MOZ_DEPRECATED
|
2008-03-12 11:00:24 +00:00
|
|
|
#endif
|
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/**
|
|
|
|
* Generic API modifiers which return the standard XPCOM nsresult type
|
|
|
|
*/
|
|
|
|
#define NS_IMETHOD NS_IMETHOD_(nsresult)
|
|
|
|
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)
|
|
|
|
#define NS_METHOD NS_METHOD_(nsresult)
|
|
|
|
#define NS_CALLBACK(_name) NS_CALLBACK_(nsresult, _name)
|
1999-05-18 21:43:13 +00:00
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/**
|
|
|
|
* Import/Export macros for XPCOM APIs
|
|
|
|
*/
|
1999-05-18 21:43:13 +00:00
|
|
|
|
2006-02-10 15:00:36 +00:00
|
|
|
#ifdef __cplusplus
|
2006-03-06 01:49:10 +00:00
|
|
|
#define NS_EXTERN_C extern "C"
|
2006-02-10 15:00:36 +00:00
|
|
|
#else
|
2006-03-06 01:49:10 +00:00
|
|
|
#define NS_EXTERN_C
|
2006-02-10 15:00:36 +00:00
|
|
|
#endif
|
|
|
|
|
2006-03-06 01:49:10 +00:00
|
|
|
#define EXPORT_XPCOM_API(type) NS_EXTERN_C NS_EXPORT type NS_FROZENCALL
|
|
|
|
#define IMPORT_XPCOM_API(type) NS_EXTERN_C NS_IMPORT type NS_FROZENCALL
|
|
|
|
#define GLUE_XPCOM_API(type) NS_EXTERN_C NS_HIDDEN_(type) NS_FROZENCALL
|
2005-11-08 18:17:49 +00:00
|
|
|
|
2013-07-12 12:56:54 +00:00
|
|
|
#ifdef IMPL_LIBXUL
|
2005-11-08 18:17:49 +00:00
|
|
|
#define XPCOM_API(type) EXPORT_XPCOM_API(type)
|
|
|
|
#elif defined(XPCOM_GLUE)
|
|
|
|
#define XPCOM_API(type) GLUE_XPCOM_API(type)
|
|
|
|
#else
|
|
|
|
#define XPCOM_API(type) IMPORT_XPCOM_API(type)
|
|
|
|
#endif
|
|
|
|
|
2005-04-06 03:35:24 +00:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2011-08-18 13:46:39 +00:00
|
|
|
# define NS_COM_GLUE
|
2005-07-01 12:24:07 +00:00
|
|
|
/*
|
|
|
|
The frozen string API has different definitions of nsAC?String
|
|
|
|
classes than the internal API. On systems that explicitly declare
|
|
|
|
dllexport symbols this is not a problem, but on ELF systems
|
|
|
|
internal symbols can accidentally "shine through"; we rename the
|
|
|
|
internal classes to avoid symbol conflicts.
|
|
|
|
*/
|
|
|
|
# define nsAString nsAString_internal
|
|
|
|
# define nsACString nsACString_internal
|
2005-04-06 03:35:24 +00:00
|
|
|
#else
|
2006-05-03 16:11:14 +00:00
|
|
|
# ifdef HAVE_VISIBILITY_ATTRIBUTE
|
|
|
|
# define NS_COM_GLUE NS_VISIBILITY_HIDDEN
|
|
|
|
# else
|
|
|
|
# define NS_COM_GLUE
|
|
|
|
# endif
|
2004-10-29 19:43:51 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-14 17:09:42 +00:00
|
|
|
#if (defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING))
|
|
|
|
/* Make refcnt logging part of the build. This doesn't mean that
|
|
|
|
* actual logging will occur (that requires a separate enable; see
|
|
|
|
* nsTraceRefcnt.h for more information). */
|
|
|
|
#define NS_BUILD_REFCNT_LOGGING
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If NO_BUILD_REFCNT_LOGGING is defined then disable refcnt logging
|
|
|
|
* in the build. This overrides FORCE_BUILD_REFCNT_LOGGING. */
|
|
|
|
#if defined(NO_BUILD_REFCNT_LOGGING)
|
|
|
|
#undef NS_BUILD_REFCNT_LOGGING
|
|
|
|
#endif
|
|
|
|
|
2010-08-08 15:06:35 +00:00
|
|
|
/* If a program allocates memory for the lifetime of the app, it doesn't make
|
|
|
|
* sense to touch memory pages and free that memory at shutdown,
|
|
|
|
* unless we are running leak stats.
|
|
|
|
*/
|
2010-07-14 17:09:42 +00:00
|
|
|
#if defined(NS_TRACE_MALLOC) || defined(NS_BUILD_REFCNT_LOGGING) || defined(MOZ_VALGRIND)
|
|
|
|
#define NS_FREE_PERMANENT_DATA
|
|
|
|
#endif
|
2004-07-14 22:14:34 +00:00
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/**
|
|
|
|
* NS_NO_VTABLE is emitted by xpidl in interface declarations whenever
|
|
|
|
* xpidl can determine that the interface can't contain a constructor.
|
|
|
|
* This results in some space savings and possible runtime savings -
|
|
|
|
* see bug 49416. We undefine it first, as xpidl-generated headers
|
|
|
|
* define it for IDL uses that don't include this file.
|
|
|
|
*/
|
|
|
|
#ifdef NS_NO_VTABLE
|
|
|
|
#undef NS_NO_VTABLE
|
1999-05-18 21:43:13 +00:00
|
|
|
#endif
|
2012-01-05 07:52:22 +00:00
|
|
|
#if defined(_MSC_VER)
|
2001-09-27 03:43:00 +00:00
|
|
|
#define NS_NO_VTABLE __declspec(novtable)
|
1999-05-18 21:43:13 +00:00
|
|
|
#else
|
2001-09-27 03:43:00 +00:00
|
|
|
#define NS_NO_VTABLE
|
1999-05-18 21:43:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-09-27 03:43:00 +00:00
|
|
|
/**
|
|
|
|
* Generic XPCOM result data type
|
|
|
|
*/
|
2012-08-07 08:27:45 +00:00
|
|
|
#include "nsError.h"
|
2001-09-27 03:43:00 +00:00
|
|
|
|
2006-02-10 15:00:36 +00:00
|
|
|
/**
|
|
|
|
* Reference count values
|
|
|
|
*
|
|
|
|
* This is the return type for AddRef() and Release() in nsISupports.
|
|
|
|
* IUnknown of COM returns an unsigned long from equivalent functions.
|
|
|
|
* The following ifdef exists to maintain binary compatibility with
|
|
|
|
* IUnknown.
|
|
|
|
*/
|
Bug 788014 - Part 1: Define nsrefcnt to be unsigned long unconditionally on Windows; r=jrmuizel
On Windows, IUknown::AddRef and IUnknown::Release are defined to
return ULONG, which is defined as unsigned long. The existing
code relies on the PR_BYTES_PER_LONG macro which is #defined in
prtypes.h to always be 4 on Windows. If we remove the prtypes.h
inclusion from nscore.h, in the places where prtypes.h is not
included by other things, we will fall into the other path in the
#ifdef condition which defines nsrefcnt to be unsigned int, which
causes the signature of AddRef and Release to change, which
results in linker errors.
There are a couple of reasons why this change is correct:
1. On both Win32 and Win64, the size of the long type is 4 bytes,
always. And prtypes.h doesn't detect the size of longs, it just
assumes it, so this check is really a tautology.
2. If the size of the long type changes on Windows, sometime,
the return value of AddRef and Release on Windows should change
size as well in order to maintain binary compatibility with
IUnknown, and before this change, the code would fail to hold
that promise.
--HG--
extra : rebase_source : 8333582b494aaca17c91cf35287a084083219050
2012-09-07 19:09:01 +00:00
|
|
|
#ifdef XP_WIN
|
2006-02-10 15:00:36 +00:00
|
|
|
typedef unsigned long nsrefcnt;
|
|
|
|
#else
|
2012-08-22 15:56:38 +00:00
|
|
|
typedef uint32_t nsrefcnt;
|
2006-02-10 15:00:36 +00:00
|
|
|
#endif
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
/*
|
2001-08-14 04:14:47 +00:00
|
|
|
* Use these macros to do 64bit safe pointer conversions.
|
|
|
|
*/
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
#define NS_PTR_TO_INT32(x) ((int32_t) (intptr_t) (x))
|
|
|
|
#define NS_PTR_TO_UINT32(x) ((uint32_t) (intptr_t) (x))
|
2012-04-12 00:17:44 +00:00
|
|
|
#define NS_INT32_TO_PTR(x) ((void *) (intptr_t) (x))
|
2001-08-14 04:14:47 +00:00
|
|
|
|
2005-03-28 19:36:24 +00:00
|
|
|
/*
|
2005-04-07 18:11:59 +00:00
|
|
|
* Use NS_STRINGIFY to form a string literal from the value of a macro.
|
2005-03-28 19:36:24 +00:00
|
|
|
*/
|
2005-04-07 18:11:59 +00:00
|
|
|
#define NS_STRINGIFY_HELPER(x_) #x_
|
|
|
|
#define NS_STRINGIFY(x_) NS_STRINGIFY_HELPER(x_)
|
2005-03-28 19:36:24 +00:00
|
|
|
|
2007-09-28 20:33:32 +00:00
|
|
|
/*
|
2009-09-12 16:49:24 +00:00
|
|
|
* If we're being linked as standalone glue, we don't want a dynamic
|
|
|
|
* dependency on NSPR libs, so we skip the debug thread-safety
|
|
|
|
* checks, and we cannot use the THREADSAFE_ISUPPORTS macros.
|
2007-09-28 20:33:32 +00:00
|
|
|
*/
|
|
|
|
#if defined(XPCOM_GLUE) && !defined(XPCOM_GLUE_USE_NSPR)
|
|
|
|
#define XPCOM_GLUE_AVOID_NSPR
|
2004-03-07 23:32:08 +00:00
|
|
|
#endif
|
|
|
|
|
2009-11-09 19:30:01 +00:00
|
|
|
#if defined(HAVE_THREAD_TLS_KEYWORD)
|
2009-10-28 17:28:57 +00:00
|
|
|
#define NS_TLS __thread
|
|
|
|
#endif
|
|
|
|
|
2011-01-11 10:16:59 +00:00
|
|
|
/*
|
|
|
|
* SEH exception macros.
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_SEH_EXCEPTIONS
|
|
|
|
#define MOZ_SEH_TRY __try
|
|
|
|
#define MOZ_SEH_EXCEPT(expr) __except(expr)
|
|
|
|
#else
|
2011-10-17 14:59:28 +00:00
|
|
|
#define MOZ_SEH_TRY if(true)
|
2011-01-11 10:16:59 +00:00
|
|
|
#define MOZ_SEH_EXCEPT(expr) else
|
|
|
|
#endif
|
|
|
|
|
1999-05-18 21:43:13 +00:00
|
|
|
#endif /* nscore_h___ */
|