0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd::js: Workaround SpiderMonkey linkage bug when DEBUG is defined.

This commit is contained in:
Jason Volk 2016-11-24 19:19:38 -08:00
parent fbbe8e604a
commit 1e1b7c8ce9
2 changed files with 23 additions and 2 deletions

View file

@ -45,6 +45,7 @@
// include directives are written as "jsxxx.h" or "mozilla/xxx.h" etc. Our includes are all
// <ircd/xxx.h> and shouldn't have any conflict issues.
#include <jsapi.h>
#include <jsfriendapi.h>
#include <js/Conversions.h>
// Some forward declarations for jsapi items not declared in the above includes,

View file

@ -21,9 +21,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <js/Initialization.h> // JS_Init() / JS_ShutDown()
#include <jsfriendapi.h>
#include <ircd/js/js.h>
#include <js/Initialization.h> // JS_Init() / JS_ShutDown()
#include <mozilla/ThreadLocal.h> // For GetThreadType() linkage hack (see: down)
namespace ircd {
namespace js {
@ -137,6 +137,26 @@ js::ReportOutOfMemory(ExclusiveContext *const c)
std::terminate();
}
//
// This DEBUG section is a fix for linkage errors when SpiderMonkey is compiled
// in debug mode.
//
#ifdef DEBUG
namespace js {
namespace oom {
extern mozilla::ThreadLocal<uint32_t> threadType;
uint32_t
GetThreadType()
{
return threadType.get();
}
} // namespace oom
} // namespace js
#endif // DEBUG
// This was only ever defined for the SpiderMonkey headers and some of our hacks above.
#undef DEBUG