From 9ce8d7e7c99e75163318428aeff6e60d398fcdca Mon Sep 17 00:00:00 2001 From: Patrick Schneider Date: Thu, 13 Apr 2017 19:39:44 +0200 Subject: [PATCH 2/2] Remove warnings on Node 6.x aka V8 5.0 and 5.1 The proposed changes targetted at 5.2 (or 5.4 to be more precise, since there is no Node release with V8 5.2 or 5.3) work for lower versions as well and bust the deprecation warnings there. Signed-off-by: Yegor Yefremov --- Lib/javascript/v8/javascriptcode.swg | 14 +++++++------- Lib/javascript/v8/javascripthelpers.swg | 8 ++++---- Lib/javascript/v8/javascriptinit.swg | 4 ++-- Lib/javascript/v8/javascriptrun.swg | 16 ++++++++-------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg index b8c5089..c4aaf3d 100644 --- a/Lib/javascript/v8/javascriptcode.swg +++ b/Lib/javascript/v8/javascriptcode.swg @@ -133,7 +133,7 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent object, v SWIGV8_Proxy *proxy = static_cast(parameter); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) static void $jswrapper(v8::Isolate *isolate, v8::Persistent *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 static void $jswrapper(const v8::WeakCallbackData &data) { v8::Local object = data.GetValue(); SWIGV8_Proxy *proxy = data.GetParameter(); @@ -150,7 +150,7 @@ static void $jswrapper(const v8::WeakCallbackData &dat } delete proxy; -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 object.Clear(); #endif @@ -160,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData &dat object.Dispose(isolate); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) object->Dispose(isolate); -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 object->Dispose(); #endif } @@ -182,7 +182,7 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent object, v SWIGV8_Proxy *proxy = static_cast(parameter); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 static void $jswrapper(const v8::WeakCallbackData &data) { v8::Local object = data.GetValue(); SWIGV8_Proxy *proxy = data.GetParameter(); @@ -205,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackInfo &data) { object->Dispose(isolate); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) object->Dispose(); -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 object.Clear(); #endif } @@ -219,7 +219,7 @@ static void $jswrapper(const v8::WeakCallbackInfo &data) { * ----------------------------------------------------------------------------- */ %fragment("js_getter", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 static SwigV8ReturnValue $jswrapper(v8::Local property, const SwigV8PropertyCallbackInfo &info) { #else static SwigV8ReturnValue $jswrapper(v8::Local property, const SwigV8PropertyCallbackInfo &info) { @@ -245,7 +245,7 @@ fail: * ----------------------------------------------------------------------------- */ %fragment("js_setter", "templates") %{ -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 static void $jswrapper(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid &info) { #else static void $jswrapper(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid &info) { diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg index 7461079..7b8a5ec 100644 --- a/Lib/javascript/v8/javascripthelpers.swg +++ b/Lib/javascript/v8/javascripthelpers.swg @@ -6,7 +6,7 @@ typedef v8::InvocationCallback SwigV8FunctionCallback; typedef v8::AccessorGetter SwigV8AccessorGetterCallback; typedef v8::AccessorSetter SwigV8AccessorSetterCallback; typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid; -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 typedef v8::FunctionCallback SwigV8FunctionCallback; typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback; typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback; @@ -70,14 +70,14 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle obj, const char */ SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle obj, const char* symbol, SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); #else obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter); #endif } -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid& info) #else SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::Local value, const SwigV8PropertyCallbackInfoVoid& info) @@ -87,7 +87,7 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local property, v8::LocalWriteUtf8(buffer, 256); res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); #else diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg index 86008d9..e83f478 100644 --- a/Lib/javascript/v8/javascriptinit.swg +++ b/Lib/javascript/v8/javascriptinit.swg @@ -7,7 +7,7 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) { v8::Local global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); v8::Local mod = SWIGV8_EXTERNAL_NEW(swig_module); assert(!mod.IsEmpty()); -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod); #else v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); @@ -18,7 +18,7 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) { SWIGRUNTIME swig_module_info * SWIG_V8_GetModule(void *) { v8::Local global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 v8::Local moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data")); #else v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg index 30002c0..0af9f4e 100644 --- a/Lib/javascript/v8/javascriptrun.swg +++ b/Lib/javascript/v8/javascriptrun.swg @@ -193,7 +193,7 @@ public: void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy); -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 void (*dtor) (const v8::WeakCallbackData &data); #else void (*dtor) (const v8::WeakCallbackInfo &data); @@ -243,7 +243,7 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val SWIGV8_Proxy *proxy = static_cast(parameter); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) { -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData &data) { SWIGV8_Proxy *proxy = data.GetParameter(); #else @@ -317,7 +317,7 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle obj, void *ptr, sw } else { cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); } -#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); } else { @@ -481,7 +481,7 @@ int SwigV8Packed_Check(v8::Handle valRef) { v8::Handle objRef = valRef->ToObject(); if(objRef->InternalFieldCount() < 1) return false; -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 v8::Handle flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); #else v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); @@ -537,7 +537,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist SwigV8PackedData *cdata = static_cast(parameter); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent *object, SwigV8PackedData *cdata) { -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData &data) { v8::Local object = data.GetValue(); SwigV8PackedData *cdata = data.GetParameter(); @@ -558,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfoDispose(isolate); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) object->Dispose(); -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 object.Clear(); #endif } @@ -571,7 +571,7 @@ v8::Handle SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf // v8::Handle obj = SWIGV8_OBJECT_NEW(); v8::Local obj = SWIGV8_OBJECT_NEW(); -#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#if (V8_MAJOR_VERSION-0) < 5 obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true)); #else v8::Local privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); @@ -599,7 +599,7 @@ v8::Handle SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete); #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); -#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) +#elif (V8_MAJOR_VERSION-0) < 5 cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete); // v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete); #else -- 2.1.4