diff options
Diffstat (limited to 'meta')
9 files changed, 15 insertions, 769 deletions
diff --git a/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch b/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch deleted file mode 100644 index 885c395614..0000000000 --- a/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch +++ /dev/null | |||
@@ -1,330 +0,0 @@ | |||
1 | From 1a5aadcd66e85c63d228bfd811a521d617c22a38 Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Schneider <patrick.schneider@meetnow.eu> | ||
3 | Date: Thu, 13 Apr 2017 15:02:53 +0200 | ||
4 | Subject: [PATCH] Add Node 7.x aka V8 5.2+ support | ||
5 | |||
6 | * Use WeakCallbackInfo instead of WeakCallbackData | ||
7 | * Use GetPrivate instead of GetHiddenValue | ||
8 | * Adopted new signature for SetWeak to support destructor calling | ||
9 | * SetAccessor deprecation fixed | ||
10 | * Proper version checks where applicable | ||
11 | |||
12 | Upstream-Status: Submitted [https://github.com/swig/swig/pull/968] | ||
13 | |||
14 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
15 | --- | ||
16 | Lib/javascript/v8/javascriptcode.swg | 27 +++++++++++++++++----- | ||
17 | Lib/javascript/v8/javascripthelpers.swg | 29 +++++++++++++++++++++--- | ||
18 | Lib/javascript/v8/javascriptinit.swg | 16 +++++++++++-- | ||
19 | Lib/javascript/v8/javascriptrun.swg | 40 ++++++++++++++++++++++++++++----- | ||
20 | 4 files changed, 95 insertions(+), 17 deletions(-) | ||
21 | |||
22 | diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg | ||
23 | index fb7d55c..b8c5089 100644 | ||
24 | --- a/Lib/javascript/v8/javascriptcode.swg | ||
25 | +++ b/Lib/javascript/v8/javascriptcode.swg | ||
26 | @@ -133,10 +133,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v | ||
27 | SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); | ||
28 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
29 | static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) { | ||
30 | -#else | ||
31 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
32 | static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { | ||
33 | v8::Local<v8::Object> object = data.GetValue(); | ||
34 | SWIGV8_Proxy *proxy = data.GetParameter(); | ||
35 | +#else | ||
36 | + static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { | ||
37 | + SWIGV8_Proxy *proxy = data.GetParameter(); | ||
38 | #endif | ||
39 | |||
40 | if(proxy->swigCMemOwn && proxy->swigCObject) { | ||
41 | @@ -147,7 +150,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat | ||
42 | } | ||
43 | delete proxy; | ||
44 | |||
45 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
46 | object.Clear(); | ||
47 | +#endif | ||
48 | |||
49 | #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) | ||
50 | object.Dispose(); | ||
51 | @@ -155,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat | ||
52 | object.Dispose(isolate); | ||
53 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) | ||
54 | object->Dispose(isolate); | ||
55 | -#else | ||
56 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
57 | object->Dispose(); | ||
58 | #endif | ||
59 | } | ||
60 | @@ -177,10 +182,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v | ||
61 | SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); | ||
62 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
63 | static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) { | ||
64 | -#else | ||
65 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
66 | static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { | ||
67 | v8::Local<v8::Object> object = data.GetValue(); | ||
68 | SWIGV8_Proxy *proxy = data.GetParameter(); | ||
69 | +#else | ||
70 | +static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { | ||
71 | + SWIGV8_Proxy *proxy = data.GetParameter(); | ||
72 | #endif | ||
73 | |||
74 | if(proxy->swigCMemOwn && proxy->swigCObject) { | ||
75 | @@ -197,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat | ||
76 | object->Dispose(isolate); | ||
77 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
78 | object->Dispose(); | ||
79 | -#else | ||
80 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
81 | object.Clear(); | ||
82 | #endif | ||
83 | } | ||
84 | @@ -211,7 +219,11 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat | ||
85 | * ----------------------------------------------------------------------------- */ | ||
86 | %fragment("js_getter", "templates") | ||
87 | %{ | ||
88 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
89 | static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) { | ||
90 | +#else | ||
91 | +static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) { | ||
92 | +#endif | ||
93 | SWIGV8_HANDLESCOPE(); | ||
94 | |||
95 | v8::Handle<v8::Value> jsresult; | ||
96 | @@ -233,8 +245,11 @@ fail: | ||
97 | * ----------------------------------------------------------------------------- */ | ||
98 | %fragment("js_setter", "templates") | ||
99 | %{ | ||
100 | -static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, | ||
101 | - const SwigV8PropertyCallbackInfoVoid &info) { | ||
102 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
103 | +static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) { | ||
104 | +#else | ||
105 | +static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) { | ||
106 | +#endif | ||
107 | SWIGV8_HANDLESCOPE(); | ||
108 | |||
109 | $jslocals | ||
110 | diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg | ||
111 | index 091467d..7461079 100644 | ||
112 | --- a/Lib/javascript/v8/javascripthelpers.swg | ||
113 | +++ b/Lib/javascript/v8/javascripthelpers.swg | ||
114 | @@ -6,11 +6,16 @@ typedef v8::InvocationCallback SwigV8FunctionCallback; | ||
115 | typedef v8::AccessorGetter SwigV8AccessorGetterCallback; | ||
116 | typedef v8::AccessorSetter SwigV8AccessorSetterCallback; | ||
117 | typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid; | ||
118 | -#else | ||
119 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
120 | typedef v8::FunctionCallback SwigV8FunctionCallback; | ||
121 | typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback; | ||
122 | typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback; | ||
123 | typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; | ||
124 | +#else | ||
125 | +typedef v8::FunctionCallback SwigV8FunctionCallback; | ||
126 | +typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback; | ||
127 | +typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback; | ||
128 | +typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; | ||
129 | #endif | ||
130 | |||
131 | /** | ||
132 | @@ -65,18 +70,36 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char | ||
133 | */ | ||
134 | SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol, | ||
135 | SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { | ||
136 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
137 | obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); | ||
138 | +#else | ||
139 | + obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter); | ||
140 | +#endif | ||
141 | } | ||
142 | |||
143 | -SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, | ||
144 | - const SwigV8PropertyCallbackInfoVoid& info) | ||
145 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
146 | +SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info) | ||
147 | +#else | ||
148 | +SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info) | ||
149 | +#endif | ||
150 | { | ||
151 | char buffer[256]; | ||
152 | char msg[512]; | ||
153 | int res; | ||
154 | |||
155 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
156 | property->WriteUtf8(buffer, 256); | ||
157 | res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); | ||
158 | +#else | ||
159 | + v8::Local<v8::String> sproperty; | ||
160 | + if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) { | ||
161 | + sproperty->WriteUtf8(buffer, 256); | ||
162 | + res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); | ||
163 | + } | ||
164 | + else { | ||
165 | + res = -1; | ||
166 | + } | ||
167 | +#endif | ||
168 | |||
169 | if(res<0) { | ||
170 | SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); | ||
171 | diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg | ||
172 | index 34befa7..86008d9 100644 | ||
173 | --- a/Lib/javascript/v8/javascriptinit.swg | ||
174 | +++ b/Lib/javascript/v8/javascriptinit.swg | ||
175 | @@ -7,15 +7,27 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) { | ||
176 | v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); | ||
177 | v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module); | ||
178 | assert(!mod.IsEmpty()); | ||
179 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
180 | global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod); | ||
181 | +#else | ||
182 | + v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); | ||
183 | + global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod); | ||
184 | +#endif | ||
185 | } | ||
186 | |||
187 | SWIGRUNTIME swig_module_info * | ||
188 | SWIG_V8_GetModule(void *) { | ||
189 | v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); | ||
190 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
191 | v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data")); | ||
192 | +#else | ||
193 | + v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); | ||
194 | + v8::Local<v8::Value> moduleinfo; | ||
195 | + if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo)) | ||
196 | + return 0; | ||
197 | +#endif | ||
198 | |||
199 | - if (moduleinfo.IsEmpty()) | ||
200 | + if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined()) | ||
201 | { | ||
202 | // It's not yet loaded | ||
203 | return 0; | ||
204 | @@ -23,7 +35,7 @@ SWIG_V8_GetModule(void *) { | ||
205 | |||
206 | v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo); | ||
207 | |||
208 | - if (moduleinfo_extern.IsEmpty()) | ||
209 | + if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined()) | ||
210 | { | ||
211 | // Something's not right | ||
212 | return 0; | ||
213 | diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg | ||
214 | index 5ac52a5..30002c0 100644 | ||
215 | --- a/Lib/javascript/v8/javascriptrun.swg | ||
216 | +++ b/Lib/javascript/v8/javascriptrun.swg | ||
217 | @@ -193,8 +193,10 @@ public: | ||
218 | void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter); | ||
219 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
220 | void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy); | ||
221 | -#else | ||
222 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
223 | void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data); | ||
224 | +#else | ||
225 | + void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data); | ||
226 | #endif | ||
227 | }; | ||
228 | |||
229 | @@ -241,9 +243,12 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val | ||
230 | SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); | ||
231 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
232 | SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) { | ||
233 | -#else | ||
234 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
235 | SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { | ||
236 | SWIGV8_Proxy *proxy = data.GetParameter(); | ||
237 | +#else | ||
238 | +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { | ||
239 | + SWIGV8_Proxy *proxy = data.GetParameter(); | ||
240 | #endif | ||
241 | |||
242 | delete proxy; | ||
243 | @@ -312,12 +317,18 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw | ||
244 | } else { | ||
245 | cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); | ||
246 | } | ||
247 | -#else | ||
248 | +#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
249 | if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { | ||
250 | cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); | ||
251 | } else { | ||
252 | cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor); | ||
253 | } | ||
254 | +#else | ||
255 | + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { | ||
256 | + cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter); | ||
257 | + } else { | ||
258 | + cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter); | ||
259 | + } | ||
260 | #endif | ||
261 | |||
262 | #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) | ||
263 | @@ -470,7 +481,14 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) { | ||
264 | |||
265 | v8::Handle<v8::Object> objRef = valRef->ToObject(); | ||
266 | if(objRef->InternalFieldCount() < 1) return false; | ||
267 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
268 | v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); | ||
269 | +#else | ||
270 | + v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); | ||
271 | + v8::Local<v8::Value> flag; | ||
272 | + if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag)) | ||
273 | + return false; | ||
274 | +#endif | ||
275 | return (flag->IsBoolean() && flag->BooleanValue()); | ||
276 | } | ||
277 | |||
278 | @@ -519,10 +537,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist | ||
279 | SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter); | ||
280 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
281 | SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) { | ||
282 | -#else | ||
283 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
284 | SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) { | ||
285 | v8::Local<v8::Object> object = data.GetValue(); | ||
286 | SwigV8PackedData *cdata = data.GetParameter(); | ||
287 | +#else | ||
288 | +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) { | ||
289 | + SwigV8PackedData *cdata = data.GetParameter(); | ||
290 | #endif | ||
291 | |||
292 | delete cdata; | ||
293 | @@ -537,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob | ||
294 | object->Dispose(isolate); | ||
295 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
296 | object->Dispose(); | ||
297 | -#else | ||
298 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
299 | object.Clear(); | ||
300 | #endif | ||
301 | } | ||
302 | @@ -550,7 +571,12 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf | ||
303 | // v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW(); | ||
304 | v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW(); | ||
305 | |||
306 | +#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
307 | obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true)); | ||
308 | +#else | ||
309 | + v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); | ||
310 | + obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true)); | ||
311 | +#endif | ||
312 | |||
313 | #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) | ||
314 | obj->SetPointerInInternalField(0, cdata); | ||
315 | @@ -573,9 +599,11 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf | ||
316 | cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete); | ||
317 | #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) | ||
318 | cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); | ||
319 | -#else | ||
320 | +#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) | ||
321 | cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete); | ||
322 | // v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete); | ||
323 | +#else | ||
324 | + cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter); | ||
325 | #endif | ||
326 | |||
327 | #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) | ||
328 | -- | ||
329 | 2.9.5 | ||
330 | |||
diff --git a/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch b/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch deleted file mode 100644 index f4ed782a82..0000000000 --- a/meta/recipes-devtools/swig/swig/0001-Fix-generated-code-for-constant-expressions-containi.patch +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | From 90ba174fcea1618af57aa594199541d47a89b7f6 Mon Sep 17 00:00:00 2001 | ||
2 | From: William S Fulton <wsf@fultondesigns.co.uk> | ||
3 | Date: Sun, 17 Sep 2017 19:02:55 +0100 | ||
4 | Subject: [PATCH 1/2] Fix generated code for constant expressions containing | ||
5 | wchar_t L literals. | ||
6 | |||
7 | Such as: | ||
8 | # define __WCHAR_MAX (0x7fffffff + L'\0') | ||
9 | |||
10 | Reported on swig-user mailing list. | ||
11 | --- | ||
12 | CHANGES.current | 5 +++++ | ||
13 | Examples/test-suite/csharp/preproc_constants_c_runme.cs | 3 ++- | ||
14 | Examples/test-suite/csharp/preproc_constants_runme.cs | 2 ++ | ||
15 | Examples/test-suite/d/preproc_constants_c_runme.1.d | 2 ++ | ||
16 | Examples/test-suite/d/preproc_constants_c_runme.2.d | 2 ++ | ||
17 | Examples/test-suite/d/preproc_constants_runme.1.d | 2 ++ | ||
18 | Examples/test-suite/d/preproc_constants_runme.2.d | 2 ++ | ||
19 | Examples/test-suite/php/preproc_constants_c_runme.php | 2 ++ | ||
20 | Examples/test-suite/php/preproc_constants_runme.php | 2 ++ | ||
21 | Examples/test-suite/php5/preproc_constants_c_runme.php | 2 ++ | ||
22 | Examples/test-suite/php5/preproc_constants_runme.php | 2 ++ | ||
23 | Examples/test-suite/preproc_constants.i | 3 +++ | ||
24 | Source/CParse/parser.y | 2 +- | ||
25 | 13 files changed, 29 insertions(+), 2 deletions(-) | ||
26 | |||
27 | Upstream-Status: Backport | ||
28 | [https://github.com/swig/swig/commit/90ba174fcea1618af57aa594199541d47a89b7f6] | ||
29 | Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> | ||
30 | |||
31 | diff --git a/Examples/test-suite/csharp/preproc_constants_c_runme.cs b/Examples/test-suite/csharp/preproc_constants_c_runme.cs | ||
32 | index 76c684d..1c28e49 100644 | ||
33 | --- a/Examples/test-suite/csharp/preproc_constants_c_runme.cs | ||
34 | +++ b/Examples/test-suite/csharp/preproc_constants_c_runme.cs | ||
35 | @@ -61,7 +61,8 @@ public class runme { | ||
36 | assert( typeof(int) == preproc_constants_c.EXPR_LAND.GetType() ); | ||
37 | assert( typeof(int) == preproc_constants_c.EXPR_LOR.GetType() ); | ||
38 | assert( typeof(double) == preproc_constants_c.EXPR_CONDITIONAL.GetType() ); | ||
39 | - | ||
40 | + assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MAX.GetType() ); | ||
41 | + assert( typeof(int) == preproc_constants_c.EXPR_WCHAR_MIN.GetType() ); | ||
42 | } | ||
43 | static void assert(bool assertion) { | ||
44 | if (!assertion) | ||
45 | diff --git a/Examples/test-suite/csharp/preproc_constants_runme.cs b/Examples/test-suite/csharp/preproc_constants_runme.cs | ||
46 | index 9fae591..6b02e30 100644 | ||
47 | --- a/Examples/test-suite/csharp/preproc_constants_runme.cs | ||
48 | +++ b/Examples/test-suite/csharp/preproc_constants_runme.cs | ||
49 | @@ -60,6 +60,8 @@ public class runme { | ||
50 | assert( typeof(bool) == preproc_constants.EXPR_LAND.GetType() ); | ||
51 | assert( typeof(bool) == preproc_constants.EXPR_LOR.GetType() ); | ||
52 | assert( typeof(double) == preproc_constants.EXPR_CONDITIONAL.GetType() ); | ||
53 | + assert( typeof(int) == preproc_constants.EXPR_WCHAR_MAX.GetType() ); | ||
54 | + assert( typeof(int) == preproc_constants.EXPR_WCHAR_MIN.GetType() ); | ||
55 | |||
56 | } | ||
57 | static void assert(bool assertion) { | ||
58 | diff --git a/Examples/test-suite/d/preproc_constants_c_runme.1.d b/Examples/test-suite/d/preproc_constants_c_runme.1.d | ||
59 | index d846c71..2b349af 100644 | ||
60 | --- a/Examples/test-suite/d/preproc_constants_c_runme.1.d | ||
61 | +++ b/Examples/test-suite/d/preproc_constants_c_runme.1.d | ||
62 | @@ -61,4 +61,6 @@ void main() { | ||
63 | static assert(is(int == typeof(EXPR_LAND()))); | ||
64 | static assert(is(int == typeof(EXPR_LOR()))); | ||
65 | static assert(is(double == typeof(EXPR_CONDITIONAL()))); | ||
66 | + static assert(is(int == typeof(EXPR_WCHAR_MAX()))); | ||
67 | + static assert(is(int == typeof(EXPR_WCHAR_MIN()))); | ||
68 | } | ||
69 | diff --git a/Examples/test-suite/d/preproc_constants_c_runme.2.d b/Examples/test-suite/d/preproc_constants_c_runme.2.d | ||
70 | index 9bdbb93..1bac525 100644 | ||
71 | --- a/Examples/test-suite/d/preproc_constants_c_runme.2.d | ||
72 | +++ b/Examples/test-suite/d/preproc_constants_c_runme.2.d | ||
73 | @@ -61,4 +61,6 @@ void main() { | ||
74 | static assert(is(int == typeof(EXPR_LAND()))); | ||
75 | static assert(is(int == typeof(EXPR_LOR()))); | ||
76 | static assert(is(double == typeof(EXPR_CONDITIONAL()))); | ||
77 | + static assert(is(int == typeof(EXPR_WCHAR_MAX()))); | ||
78 | + static assert(is(int == typeof(EXPR_WCHAR_MIN()))); | ||
79 | } | ||
80 | diff --git a/Examples/test-suite/d/preproc_constants_runme.1.d b/Examples/test-suite/d/preproc_constants_runme.1.d | ||
81 | index 009405f..f743f48 100644 | ||
82 | --- a/Examples/test-suite/d/preproc_constants_runme.1.d | ||
83 | +++ b/Examples/test-suite/d/preproc_constants_runme.1.d | ||
84 | @@ -60,4 +60,6 @@ void main() { | ||
85 | static assert(is(bool == typeof(EXPR_LAND()))); | ||
86 | static assert(is(bool == typeof(EXPR_LOR()))); | ||
87 | static assert(is(double == typeof(EXPR_CONDITIONAL()))); | ||
88 | + static assert(is(int == typeof(EXPR_WCHAR_MAX()))); | ||
89 | + static assert(is(int == typeof(EXPR_WCHAR_MIN()))); | ||
90 | } | ||
91 | diff --git a/Examples/test-suite/d/preproc_constants_runme.2.d b/Examples/test-suite/d/preproc_constants_runme.2.d | ||
92 | index 2d92ef0..0d96c37 100644 | ||
93 | --- a/Examples/test-suite/d/preproc_constants_runme.2.d | ||
94 | +++ b/Examples/test-suite/d/preproc_constants_runme.2.d | ||
95 | @@ -60,4 +60,6 @@ void main() { | ||
96 | static assert(is(bool == typeof(EXPR_LAND()))); | ||
97 | static assert(is(bool == typeof(EXPR_LOR()))); | ||
98 | static assert(is(double == typeof(EXPR_CONDITIONAL()))); | ||
99 | + static assert(is(int == typeof(EXPR_WCHAR_MAX()))); | ||
100 | + static assert(is(int == typeof(EXPR_WCHAR_MIN()))); | ||
101 | } | ||
102 | diff --git a/Examples/test-suite/php/preproc_constants_c_runme.php b/Examples/test-suite/php/preproc_constants_c_runme.php | ||
103 | index af9b76e..e59fe18 100644 | ||
104 | --- a/Examples/test-suite/php/preproc_constants_c_runme.php | ||
105 | +++ b/Examples/test-suite/php/preproc_constants_c_runme.php | ||
106 | @@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant | ||
107 | check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type"); | ||
108 | check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); | ||
109 | check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); | ||
110 | +check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); | ||
111 | +check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); | ||
112 | |||
113 | ?> | ||
114 | diff --git a/Examples/test-suite/php/preproc_constants_runme.php b/Examples/test-suite/php/preproc_constants_runme.php | ||
115 | index 5c9119b..8e117ea 100644 | ||
116 | --- a/Examples/test-suite/php/preproc_constants_runme.php | ||
117 | +++ b/Examples/test-suite/php/preproc_constants_runme.php | ||
118 | @@ -61,5 +61,7 @@ check::equal(gettype(preproc_constants::EXPR_OR), "integer", "preproc_constants. | ||
119 | check::equal(gettype(preproc_constants::EXPR_LAND), "boolean", "preproc_constants.EXPR_LAND has unexpected type"); | ||
120 | check::equal(gettype(preproc_constants::EXPR_LOR), "boolean", "preproc_constants.EXPR_LOR has unexpected type"); | ||
121 | check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); | ||
122 | +check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); | ||
123 | +check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); | ||
124 | |||
125 | ?> | ||
126 | diff --git a/Examples/test-suite/php5/preproc_constants_c_runme.php b/Examples/test-suite/php5/preproc_constants_c_runme.php | ||
127 | index 1ea0195..d978fab 100644 | ||
128 | --- a/Examples/test-suite/php5/preproc_constants_c_runme.php | ||
129 | +++ b/Examples/test-suite/php5/preproc_constants_c_runme.php | ||
130 | @@ -62,5 +62,7 @@ check::equal(gettype(preproc_constants_c::EXPR_OR), "integer", "preproc_constant | ||
131 | check::equal(gettype(preproc_constants_c::EXPR_LAND), "integer", "preproc_constants.EXPR_LAND has unexpected type"); | ||
132 | check::equal(gettype(preproc_constants_c::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); | ||
133 | check::equal(gettype(preproc_constants_c::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); | ||
134 | +check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); | ||
135 | +check::equal(gettype(preproc_constants_c::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); | ||
136 | |||
137 | ?> | ||
138 | diff --git a/Examples/test-suite/php5/preproc_constants_runme.php b/Examples/test-suite/php5/preproc_constants_runme.php | ||
139 | index fb9ee4f..7527026 100644 | ||
140 | --- a/Examples/test-suite/php5/preproc_constants_runme.php | ||
141 | +++ b/Examples/test-suite/php5/preproc_constants_runme.php | ||
142 | @@ -70,5 +70,7 @@ check::equal(gettype(preproc_constants::EXPR_LAND), "integer", "preproc_constant | ||
143 | check::equal(gettype(preproc_constants::EXPR_LOR), "integer", "preproc_constants.EXPR_LOR has unexpected type"); | ||
144 | |||
145 | check::equal(gettype(preproc_constants::EXPR_CONDITIONAL), "double", "preproc_constants.EXPR_CONDITIONAL has unexpected type"); | ||
146 | +check::equal(gettype(preproc_constants::EXPR_WCHAR_MAX), "integer", "preproc_constants.EXPR_WCHAR_MAX has unexpected type"); | ||
147 | +check::equal(gettype(preproc_constants::EXPR_WCHAR_MIN), "integer", "preproc_constants.EXPR_WCHAR_MIN has unexpected type"); | ||
148 | |||
149 | ?> | ||
150 | diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i | ||
151 | index 3a999ad..16b44c9 100644 | ||
152 | --- a/Examples/test-suite/preproc_constants.i | ||
153 | +++ b/Examples/test-suite/preproc_constants.i | ||
154 | @@ -87,6 +87,9 @@ | ||
155 | #define EXPR_LOR 0xFF || 1 | ||
156 | #define EXPR_CONDITIONAL true ? 2 : 2.2 | ||
157 | |||
158 | +#define EXPR_WCHAR_MAX (0x7fffffff + L'\0') | ||
159 | +#define EXPR_WCHAR_MIN (-EXPR_WCHAR_MAX - 1) | ||
160 | + | ||
161 | #define EXPR_CHAR_COMPOUND_ADD 'A' + 12 | ||
162 | #define EXPR_CHAR_COMPOUND_LSHIFT 'B' << 6 | ||
163 | #define H_SUPPRESS_SCALING_MAGIC (('s'<<24) | ('u'<<16) | ('p'<<8) | 'p') | ||
164 | diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y | ||
165 | index 2e92cd0..273dadb 100644 | ||
166 | --- a/Source/CParse/parser.y | ||
167 | +++ b/Source/CParse/parser.y | ||
168 | @@ -194,7 +194,7 @@ int SWIG_cparse_template_reduce(int treduce) { | ||
169 | * ----------------------------------------------------------------------------- */ | ||
170 | |||
171 | static int promote_type(int t) { | ||
172 | - if (t <= T_UCHAR || t == T_CHAR) return T_INT; | ||
173 | + if (t <= T_UCHAR || t == T_CHAR || t == T_WCHAR) return T_INT; | ||
174 | return t; | ||
175 | } | ||
176 | |||
177 | -- | ||
178 | 2.9.5 | ||
179 | |||
diff --git a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch b/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch index 81df3e264f..f27f80ea18 100644 --- a/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch +++ b/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch | |||
@@ -13,13 +13,11 @@ http://sourceforge.net/mailarchive/message.php?msg_id=29179733 | |||
13 | Source/Modules/main.cxx | 24 ++++++++++++++++++++++-- | 13 | Source/Modules/main.cxx | 24 ++++++++++++++++++++++-- |
14 | 1 file changed, 22 insertions(+), 2 deletions(-) | 14 | 1 file changed, 22 insertions(+), 2 deletions(-) |
15 | 15 | ||
16 | diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx | ||
17 | index d2f5d3b..cbb0a12 100644 | ||
18 | --- a/Source/Modules/main.cxx | 16 | --- a/Source/Modules/main.cxx |
19 | +++ b/Source/Modules/main.cxx | 17 | +++ b/Source/Modules/main.cxx |
20 | @@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$"; | 18 | @@ -25,6 +25,11 @@ |
21 | #include "cparse.h" | ||
22 | #include <ctype.h> | 19 | #include <ctype.h> |
20 | #include <errno.h> | ||
23 | #include <limits.h> // for INT_MAX | 21 | #include <limits.h> // for INT_MAX |
24 | +#ifndef _WIN32 | 22 | +#ifndef _WIN32 |
25 | +#include <cstddef> | 23 | +#include <cstddef> |
@@ -29,7 +27,7 @@ index d2f5d3b..cbb0a12 100644 | |||
29 | 27 | ||
30 | // Global variables | 28 | // Global variables |
31 | 29 | ||
32 | @@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) { | 30 | @@ -934,9 +939,9 @@ int SWIG_main(int argc, char *argv[], co |
33 | 31 | ||
34 | // Check for SWIG_LIB environment variable | 32 | // Check for SWIG_LIB environment variable |
35 | if ((c = getenv("SWIG_LIB")) == (char *) 0) { | 33 | if ((c = getenv("SWIG_LIB")) == (char *) 0) { |
@@ -40,7 +38,7 @@ index d2f5d3b..cbb0a12 100644 | |||
40 | if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) { | 38 | if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) { |
41 | *(p + 1) = '\0'; | 39 | *(p + 1) = '\0'; |
42 | SwigLib = NewStringf("%sLib", buf); // Native windows installation path | 40 | SwigLib = NewStringf("%sLib", buf); // Native windows installation path |
43 | @@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) { | 41 | @@ -946,7 +951,22 @@ int SWIG_main(int argc, char *argv[], co |
44 | if (Len(SWIG_LIB_WIN_UNIX) > 0) | 42 | if (Len(SWIG_LIB_WIN_UNIX) > 0) |
45 | SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw) | 43 | SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw) |
46 | #else | 44 | #else |
@@ -64,6 +62,3 @@ index d2f5d3b..cbb0a12 100644 | |||
64 | #endif | 62 | #endif |
65 | } else { | 63 | } else { |
66 | SwigLib = NewString(c); | 64 | SwigLib = NewString(c); |
67 | -- | ||
68 | 1.7.9.5 | ||
69 | |||
diff --git a/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch b/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch index 1b1128acab..114de7ed94 100644 --- a/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch +++ b/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch | |||
@@ -9,11 +9,9 @@ Upstream-Status: pending | |||
9 | configure.ac | 38 +++++++------------------------------- | 9 | configure.ac | 38 +++++++------------------------------- |
10 | 1 file changed, 7 insertions(+), 31 deletions(-) | 10 | 1 file changed, 7 insertions(+), 31 deletions(-) |
11 | 11 | ||
12 | diff --git a/configure.ac b/configure.ac | ||
13 | index 0c984b7..6edcec1 100644 | ||
14 | --- a/configure.ac | 12 | --- a/configure.ac |
15 | +++ b/configure.ac | 13 | +++ b/configure.ac |
16 | @@ -70,38 +70,14 @@ AC_MSG_RESULT([$with_pcre]) | 14 | @@ -52,38 +52,14 @@ AC_MSG_RESULT([$with_pcre]) |
17 | 15 | ||
18 | dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script | 16 | dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script |
19 | if test x"${with_pcre}" = xyes ; then | 17 | if test x"${with_pcre}" = xyes ; then |
@@ -59,6 +57,3 @@ index 0c984b7..6edcec1 100644 | |||
59 | 57 | ||
60 | 58 | ||
61 | dnl CCache | 59 | dnl CCache |
62 | -- | ||
63 | 1.9.3 | ||
64 | |||
diff --git a/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch b/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch deleted file mode 100644 index a91385916c..0000000000 --- a/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch +++ /dev/null | |||
@@ -1,191 +0,0 @@ | |||
1 | From b6c0ef4b8f6e5c089ac7104b3aaba8f1d17b8b82 Mon Sep 17 00:00:00 2001 | ||
2 | From: Olly Betts <olly@survex.com> | ||
3 | Date: Mon, 11 Jun 2018 15:51:53 +1200 | ||
4 | Subject: [PATCH] [Python] Fix new GCC8 warnings in generated code | ||
5 | |||
6 | Avoid casts between incompatible function types where possible (when | ||
7 | keyword args are in use, it is not possible to avoid such warnings as | ||
8 | they are inherent in the design of Python's C API in that particular | ||
9 | case). Fixes #1259. | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | [https://github.com/swig/swig/commit/7f9883011029674553a2a4b623d459f02b512458] | ||
13 | |||
14 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
15 | --- | ||
16 | Lib/python/pyinit.swg | 4 ++-- | ||
17 | Lib/python/pyrun.swg | 34 ++++++++++++++++++++++++++-------- | ||
18 | Source/Modules/python.cxx | 26 +++++++++++++------------- | ||
19 | 3 files changed, 41 insertions(+), 23 deletions(-) | ||
20 | |||
21 | diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg | ||
22 | index 2cc5828..6bf68c1 100644 | ||
23 | --- a/Lib/python/pyinit.swg | ||
24 | +++ b/Lib/python/pyinit.swg | ||
25 | @@ -368,8 +368,8 @@ SWIG_init(void) { | ||
26 | (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL | ||
27 | }; | ||
28 | static SwigPyGetSet thisown_getset_closure = { | ||
29 | - (PyCFunction) SwigPyObject_own, | ||
30 | - (PyCFunction) SwigPyObject_own | ||
31 | + SwigPyObject_own, | ||
32 | + SwigPyObject_own | ||
33 | }; | ||
34 | static PyGetSetDef thisown_getset_def = { | ||
35 | (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure | ||
36 | diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg | ||
37 | index ab1237f..3d0b1b3 100644 | ||
38 | --- a/Lib/python/pyrun.swg | ||
39 | +++ b/Lib/python/pyrun.swg | ||
40 | @@ -465,6 +465,14 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args) | ||
41 | return repr; | ||
42 | } | ||
43 | |||
44 | +/* We need a version taking two PyObject* parameters so it's a valid | ||
45 | + * PyCFunction to use in swigobject_methods[]. */ | ||
46 | +SWIGRUNTIME PyObject * | ||
47 | +SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) | ||
48 | +{ | ||
49 | + return SwigPyObject_repr((SwigPyObject*)v); | ||
50 | +} | ||
51 | + | ||
52 | SWIGRUNTIME int | ||
53 | SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) | ||
54 | { | ||
55 | @@ -594,11 +602,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) | ||
56 | } | ||
57 | |||
58 | SWIGRUNTIME PyObject* | ||
59 | -#ifdef METH_NOARGS | ||
60 | -SwigPyObject_next(PyObject* v) | ||
61 | -#else | ||
62 | SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) | ||
63 | -#endif | ||
64 | { | ||
65 | SwigPyObject *sobj = (SwigPyObject *) v; | ||
66 | if (sobj->next) { | ||
67 | @@ -633,6 +637,20 @@ SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) | ||
68 | return SWIG_Py_Void(); | ||
69 | } | ||
70 | |||
71 | +#ifdef METH_NOARGS | ||
72 | +static PyObject* | ||
73 | +SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) | ||
74 | +{ | ||
75 | + return SwigPyObject_disown(v); | ||
76 | +} | ||
77 | + | ||
78 | +static PyObject* | ||
79 | +SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) | ||
80 | +{ | ||
81 | + return SwigPyObject_acquire(v); | ||
82 | +} | ||
83 | +#endif | ||
84 | + | ||
85 | SWIGINTERN PyObject* | ||
86 | SwigPyObject_own(PyObject *v, PyObject *args) | ||
87 | { | ||
88 | @@ -673,12 +691,12 @@ SwigPyObject_own(PyObject *v, PyObject *args) | ||
89 | #ifdef METH_O | ||
90 | static PyMethodDef | ||
91 | swigobject_methods[] = { | ||
92 | - {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, | ||
93 | - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, | ||
94 | + {(char *)"disown", (PyCFunction)SwigPyObject_disown2, METH_NOARGS, (char *)"releases ownership of the pointer"}, | ||
95 | + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS, (char *)"acquires ownership of the pointer"}, | ||
96 | {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, | ||
97 | {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, | ||
98 | {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, | ||
99 | - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, | ||
100 | + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr2, METH_NOARGS, (char *)"returns object representation"}, | ||
101 | {0, 0, 0, 0} | ||
102 | }; | ||
103 | #else | ||
104 | @@ -689,7 +707,7 @@ swigobject_methods[] = { | ||
105 | {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, | ||
106 | {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, | ||
107 | {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, | ||
108 | - {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, | ||
109 | + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, | ||
110 | {0, 0, 0, 0} | ||
111 | }; | ||
112 | #endif | ||
113 | diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx | ||
114 | index a6801fc..72eaa77 100644 | ||
115 | --- a/Source/Modules/python.cxx | ||
116 | +++ b/Source/Modules/python.cxx | ||
117 | @@ -1109,7 +1109,7 @@ public: | ||
118 | * ------------------------------------------------------------ */ | ||
119 | int add_pyinstancemethod_new() { | ||
120 | String *name = NewString("SWIG_PyInstanceMethod_New"); | ||
121 | - Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, NULL},\n", name, name); | ||
122 | + Printf(methods, "\t { \"%s\", %s, METH_O, NULL},\n", name, name); | ||
123 | Delete(name); | ||
124 | return 0; | ||
125 | } | ||
126 | @@ -2479,17 +2479,17 @@ public: | ||
127 | if (!kw) { | ||
128 | if (n && funpack) { | ||
129 | if (num_required == 0 && num_arguments == 0) { | ||
130 | - Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_NOARGS, ", name, function); | ||
131 | + Printf(methods, "\t { \"%s\", %s, METH_NOARGS, ", name, function); | ||
132 | } else if (num_required == 1 && num_arguments == 1) { | ||
133 | - Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, ", name, function); | ||
134 | + Printf(methods, "\t { \"%s\", %s, METH_O, ", name, function); | ||
135 | } else { | ||
136 | - Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function); | ||
137 | + Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function); | ||
138 | } | ||
139 | } else { | ||
140 | - Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function); | ||
141 | + Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function); | ||
142 | } | ||
143 | } else { | ||
144 | - Printf(methods, "\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function); | ||
145 | + Printf(methods, "\t { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, ", name, function); | ||
146 | } | ||
147 | |||
148 | if (!n) { | ||
149 | @@ -3857,7 +3857,7 @@ public: | ||
150 | if (shadow) { | ||
151 | if (builtin) { | ||
152 | String *rname = SwigType_namestr(real_classname); | ||
153 | - Printf(builtin_methods, " { \"__disown__\", (PyCFunction) Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname); | ||
154 | + Printf(builtin_methods, " { \"__disown__\", Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname); | ||
155 | Delete(rname); | ||
156 | } else { | ||
157 | String *symname = Getattr(n, "sym:name"); | ||
158 | @@ -4694,13 +4694,13 @@ public: | ||
159 | int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2; | ||
160 | String *ds = have_docstring(n) ? cdocstring(n, AUTODOC_FUNC) : NewString(""); | ||
161 | if (check_kwargs(n)) { | ||
162 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS|METH_KEYWORDS, (char *) \"%s\" },\n", symname, wname, ds); | ||
163 | + Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, \"%s\" },\n", symname, wname, ds); | ||
164 | } else if (argcount == 0) { | ||
165 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_NOARGS, (char *) \"%s\" },\n", symname, wname, ds); | ||
166 | + Printf(builtin_methods, " { \"%s\", %s, METH_NOARGS, \"%s\" },\n", symname, wname, ds); | ||
167 | } else if (argcount == 1) { | ||
168 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_O, (char *) \"%s\" },\n", symname, wname, ds); | ||
169 | + Printf(builtin_methods, " { \"%s\", %s, METH_O, \"%s\" },\n", symname, wname, ds); | ||
170 | } else { | ||
171 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS, (char *) \"%s\" },\n", symname, wname, ds); | ||
172 | + Printf(builtin_methods, " { \"%s\", %s, METH_VARARGS, \"%s\" },\n", symname, wname, ds); | ||
173 | } | ||
174 | Delete(fullname); | ||
175 | Delete(wname); | ||
176 | @@ -4801,10 +4801,10 @@ public: | ||
177 | Append(pyflags, "METH_VARARGS"); | ||
178 | if (have_docstring(n)) { | ||
179 | String *ds = cdocstring(n, AUTODOC_STATICFUNC); | ||
180 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, (char *) \"%s\" },\n", symname, wname, pyflags, ds); | ||
181 | + Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, %s, \"%s\" },\n", symname, wname, pyflags, ds); | ||
182 | Delete(ds); | ||
183 | } else { | ||
184 | - Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, \"\" },\n", symname, wname, pyflags); | ||
185 | + Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, %s, \"\" },\n", symname, wname, pyflags); | ||
186 | } | ||
187 | Delete(fullname); | ||
188 | Delete(wname); | ||
189 | -- | ||
190 | 2.7.4 | ||
191 | |||
diff --git a/meta/recipes-devtools/swig/swig/determinism.patch b/meta/recipes-devtools/swig/swig/determinism.patch index 8ffb4bce8e..84c399182a 100644 --- a/meta/recipes-devtools/swig/swig/determinism.patch +++ b/meta/recipes-devtools/swig/swig/determinism.patch | |||
@@ -5,11 +5,9 @@ Upstream-Status: Inappropriate [OE reproducibiity fix upstream unlikely to take] | |||
5 | RP 2021/3/1 | 5 | RP 2021/3/1 |
6 | 6 | ||
7 | 7 | ||
8 | Index: swig-3.0.12/Source/Modules/main.cxx | 8 | --- a/Source/Modules/main.cxx |
9 | =================================================================== | 9 | +++ b/Source/Modules/main.cxx |
10 | --- swig-3.0.12.orig/Source/Modules/main.cxx | 10 | @@ -642,7 +642,6 @@ static void getoptions(int argc, char *a |
11 | +++ swig-3.0.12/Source/Modules/main.cxx | ||
12 | @@ -636,7 +636,6 @@ void SWIG_getoptions(int argc, char *arg | ||
13 | } | 11 | } |
14 | } else if (strcmp(argv[i], "-version") == 0) { | 12 | } else if (strcmp(argv[i], "-version") == 0) { |
15 | fprintf(stdout, "\nSWIG Version %s\n", Swig_package_version()); | 13 | fprintf(stdout, "\nSWIG Version %s\n", Swig_package_version()); |
diff --git a/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch b/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch deleted file mode 100644 index 10e4afd1ba..0000000000 --- a/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | From 9825fcbab5c4ddd867432f9922bebfbec7b78af0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mark Dufour <m.dufour@kopano.com> | ||
3 | Date: Tue, 14 Feb 2017 10:34:37 +0100 | ||
4 | Subject: [PATCH] [Coverity] fix issue reported for SWIG_Python_FixMethods | ||
5 | |||
6 | Fix Coverity issue reported for SWIG_Python_FixMethods: | ||
7 | |||
8 | "buffer_size: Calling strncpy with a source string whose length | ||
9 | (10 chars) is greater than or equal to the size argument (10) | ||
10 | will fail to null-terminate buff." | ||
11 | |||
12 | The issue is only reported for the "swig_ptr: " line, but for | ||
13 | consistency we replace both occurrences of strncpy with memcpy. | ||
14 | --- | ||
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
16 | Upstream-Status: Backport [https://github.com/swig/swig/pull/898] | ||
17 | |||
18 | Lib/python/pyinit.swg | 4 ++-- | ||
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | Index: swig-3.0.12/Lib/python/pyinit.swg | ||
22 | =================================================================== | ||
23 | --- swig-3.0.12.orig/Lib/python/pyinit.swg | ||
24 | +++ swig-3.0.12/Lib/python/pyinit.swg | ||
25 | @@ -306,9 +306,9 @@ SWIG_Python_FixMethods(PyMethodDef *meth | ||
26 | char *ndoc = (char*)malloc(ldoc + lptr + 10); | ||
27 | if (ndoc) { | ||
28 | char *buff = ndoc; | ||
29 | - strncpy(buff, methods[i].ml_doc, ldoc); | ||
30 | + memcpy(buff, methods[i].ml_doc, ldoc); | ||
31 | buff += ldoc; | ||
32 | - strncpy(buff, "swig_ptr: ", 10); | ||
33 | + memcpy(buff, "swig_ptr: ", 10); | ||
34 | buff += 10; | ||
35 | SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); | ||
36 | methods[i].ml_doc = ndoc; | ||
diff --git a/meta/recipes-devtools/swig/swig_3.0.12.bb b/meta/recipes-devtools/swig/swig_3.0.12.bb deleted file mode 100644 index 090aaa8112..0000000000 --- a/meta/recipes-devtools/swig/swig_3.0.12.bb +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | require ${BPN}.inc | ||
2 | |||
3 | SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ | ||
4 | file://0001-configure-use-pkg-config-for-pcre-detection.patch \ | ||
5 | file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \ | ||
6 | file://swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch \ | ||
7 | file://Python-Fix-new-GCC8-warnings-in-generated-code.patch \ | ||
8 | file://0001-Fix-generated-code-for-constant-expressions-containi.patch \ | ||
9 | file://determinism.patch \ | ||
10 | " | ||
11 | SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c" | ||
12 | SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d" | ||
13 | |||
diff --git a/meta/recipes-devtools/swig/swig_4.0.2.bb b/meta/recipes-devtools/swig/swig_4.0.2.bb new file mode 100644 index 0000000000..718ad89a5d --- /dev/null +++ b/meta/recipes-devtools/swig/swig_4.0.2.bb | |||
@@ -0,0 +1,7 @@ | |||
1 | require ${BPN}.inc | ||
2 | |||
3 | SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ | ||
4 | file://0001-configure-use-pkg-config-for-pcre-detection.patch \ | ||
5 | file://determinism.patch \ | ||
6 | " | ||
7 | SRC_URI[sha256sum] = "d53be9730d8d58a16bf0cbd1f8ac0c0c3e1090573168bfa151b01eb47fa906fc" | ||