RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 23-Jun-2017 02:43:56 Branch: rpm-5_4 Handle: 2017062300435500 Modified files: (Branch: rpm-5_4) rpm/rpmio Makefile.am rpmjs45.cpp Log: - rpmjs45: muzzle GCC/ASAN. Summary: Revision Changes Path 1.293.2.97 +3 -0 rpm/rpmio/Makefile.am 1.1.2.5 +67 -7 rpm/rpmio/rpmjs45.cpp ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/Makefile.am ============================================================================ $ cvs diff -u -r1.293.2.96 -r1.293.2.97 Makefile.am --- rpm/rpmio/Makefile.am 22 Jun 2017 17:35:24 -0000 1.293.2.96 +++ rpm/rpmio/Makefile.am 23 Jun 2017 00:43:55 -0000 1.293.2.97 @@ -582,6 +582,9 @@ -./rpmjs38 -./rpmjs45 +mozjs45: rpmjs45 + @-env ASAN_OPTIONS=detect_leaks=0 ./rpmjs45 + rpmpbzip2_SOURCES = rpmpbzip2.c rpmpbzip2_LDADD = $(RPMIO_LDADD_COMMON) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmjs45.cpp ============================================================================ $ cvs diff -u -r1.1.2.4 -r1.1.2.5 rpmjs45.cpp --- rpm/rpmio/rpmjs45.cpp 22 Jun 2017 17:35:24 -0000 1.1.2.4 +++ rpm/rpmio/rpmjs45.cpp 23 Jun 2017 00:43:55 -0000 1.1.2.5 @@ -2,6 +2,8 @@ // #define __STDC_LIMIT_MACROS // #include <stdint.h> +#pragma GCC diagnostic ignored "-Winvalid-offsetof" + #include "system.h" #define js jsns @@ -14,7 +16,35 @@ #include "debug.h" -/* The class of the global object. */ +/*==============================================================*/ +#ifdef NOTYET /* XXX HandleObject and HandleId */ +static bool +global_enumerate(JSContext* cx, HandleObject obj) +{ +#ifdef LAZY_STANDARD_CLASSES + return JS_EnumerateStandardClasses(cx, obj); +#else + return true; +#endif +} + +static bool +global_resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp) +{ +#ifdef LAZY_STANDARD_CLASSES + if (!JS_ResolveStandardClass(cx, obj, id, resolvedp)) + return false; +#endif + return true; +} + +static bool +global_mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj) +{ + return JS_MayResolveStandardClass(names, id, maybeObj); +} +#endif /* NOTYET */ + static JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, @@ -22,9 +52,15 @@ nullptr, nullptr, nullptr, +#ifdef NOTYET /* XXX HandleObject and HandleId */ + global_enumerate, + global_resolve, + global_mayResolve, +#else nullptr, nullptr, nullptr, +#endif nullptr, nullptr, nullptr, @@ -32,8 +68,12 @@ JS_GlobalObjectTraceHook }; -struct rpmjs_s _js; -rpmjs js = &_js; +static int rpmjs_nopens; + +static int _rpmjs45_debug; +#define SPEW(_fmt, ...) \ + if (_rpmjs45_debug) \ + fprintf(stderr, _fmt, __VA_ARGS__) /*==============================================================*/ typedef struct JSI_s * JSI_t; @@ -52,8 +92,6 @@ } /*==============================================================*/ -static int rpmjs_nopens; - static void mozFini(rpmjs js) { JSI_t I = (JSI_t) js->I; @@ -80,6 +118,7 @@ static uint32_t _maxbytes = 8L * 1024L * 1024L; static size_t _stackChunkSize = 8192; + bool ok; if (rpmjs_nopens++ == 0) JS_Init(); @@ -95,6 +134,22 @@ assert(I->cx); JS_SetContextPrivate(I->cx, (void *)js); +#ifdef NOTYET + JS_SetErrorReporter(I->cx, rpmjsReportError); +#endif + +#ifdef HACK +#ifdef JS_HAS_CTYPES + ok = JS_InitCTypesClass(I->cx, I->global); +assert(ok); +#endif + +#ifdef NOTYET + ok = JS_DefineFunctions(I->cx, I->global, _functions); +assert(ok); +#endif +#endif + return I; } @@ -118,14 +173,16 @@ JS_NewGlobalObject(I->cx, _clasp, _principals, JS::FireOnNewGlobalHook)); if (!global) return 1; + I->global = global; assert(I->global); JS::RootedValue rval(I->cx); { // Scope for JSAutoCompartment - JSAutoCompartment ac(I->cx, global); - JS_InitStandardClasses(I->cx, global); + JSAutoCompartment ac(I->cx, I->global); + ok = JS_InitStandardClasses(I->cx, global); +assert(ok); JS::CompileOptions opts(I->cx); opts.setFileAndLine(filename, lineno); @@ -145,6 +202,9 @@ JSIO_t mozjs45 = &_mozjs45; #if defined(RPMJS_SELF_TEST) +struct rpmjs_s _js; +rpmjs js = &_js; + /*==============================================================*/ int main(int argc, const char *argv[]) { @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org