Skip to content

Commit 51f00b1

Browse files
romandevmhdawson
authored andcommitted
src: Fix warnings when running npm test
The warnings occur due to a bug in gcc(<5.1.1)[1]. To fix this issue, we can use constructor initializer instead of empty braces initializer. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489 Fixes: #164 PR-URL: #166 Reviewed-By: Michael Dawson <[email protected]>
1 parent e6430c2 commit 51f00b1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

napi-inl.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticMethod(
24752475
// TODO: Delete when the class is destroyed
24762476
StaticVoidMethodCallbackData* callbackData = new StaticVoidMethodCallbackData({ method, data });
24772477

2478-
napi_property_descriptor desc = {};
2478+
napi_property_descriptor desc = napi_property_descriptor();
24792479
desc.utf8name = utf8name;
24802480
desc.method = T::StaticVoidMethodCallbackWrapper;
24812481
desc.data = callbackData;
@@ -2492,7 +2492,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticMethod(
24922492
// TODO: Delete when the class is destroyed
24932493
StaticMethodCallbackData* callbackData = new StaticMethodCallbackData({ method, data });
24942494

2495-
napi_property_descriptor desc = {};
2495+
napi_property_descriptor desc = napi_property_descriptor();
24962496
desc.utf8name = utf8name;
24972497
desc.method = T::StaticMethodCallbackWrapper;
24982498
desc.data = callbackData;
@@ -2511,7 +2511,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticAccessor(
25112511
StaticAccessorCallbackData* callbackData =
25122512
new StaticAccessorCallbackData({ getter, setter, data });
25132513

2514-
napi_property_descriptor desc = {};
2514+
napi_property_descriptor desc = napi_property_descriptor();
25152515
desc.utf8name = utf8name;
25162516
desc.getter = getter != nullptr ? T::StaticGetterCallbackWrapper : nullptr;
25172517
desc.setter = setter != nullptr ? T::StaticSetterCallbackWrapper : nullptr;
@@ -2530,7 +2530,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
25302530
InstanceVoidMethodCallbackData* callbackData =
25312531
new InstanceVoidMethodCallbackData({ method, data});
25322532

2533-
napi_property_descriptor desc = {};
2533+
napi_property_descriptor desc = napi_property_descriptor();
25342534
desc.utf8name = utf8name;
25352535
desc.method = T::InstanceVoidMethodCallbackWrapper;
25362536
desc.data = callbackData;
@@ -2547,7 +2547,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
25472547
// TODO: Delete when the class is destroyed
25482548
InstanceMethodCallbackData* callbackData = new InstanceMethodCallbackData({ method, data });
25492549

2550-
napi_property_descriptor desc = {};
2550+
napi_property_descriptor desc = napi_property_descriptor();
25512551
desc.utf8name = utf8name;
25522552
desc.method = T::InstanceMethodCallbackWrapper;
25532553
desc.data = callbackData;
@@ -2565,7 +2565,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
25652565
InstanceVoidMethodCallbackData* callbackData =
25662566
new InstanceVoidMethodCallbackData({ method, data});
25672567

2568-
napi_property_descriptor desc = {};
2568+
napi_property_descriptor desc = napi_property_descriptor();
25692569
desc.name = name;
25702570
desc.method = T::InstanceVoidMethodCallbackWrapper;
25712571
desc.data = callbackData;
@@ -2582,7 +2582,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
25822582
// TODO: Delete when the class is destroyed
25832583
InstanceMethodCallbackData* callbackData = new InstanceMethodCallbackData({ method, data });
25842584

2585-
napi_property_descriptor desc = {};
2585+
napi_property_descriptor desc = napi_property_descriptor();
25862586
desc.name = name;
25872587
desc.method = T::InstanceMethodCallbackWrapper;
25882588
desc.data = callbackData;
@@ -2601,7 +2601,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceAccessor(
26012601
InstanceAccessorCallbackData* callbackData =
26022602
new InstanceAccessorCallbackData({ getter, setter, data });
26032603

2604-
napi_property_descriptor desc = {};
2604+
napi_property_descriptor desc = napi_property_descriptor();
26052605
desc.utf8name = utf8name;
26062606
desc.getter = getter != nullptr ? T::InstanceGetterCallbackWrapper : nullptr;
26072607
desc.setter = setter != nullptr ? T::InstanceSetterCallbackWrapper : nullptr;
@@ -2613,7 +2613,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceAccessor(
26132613
template <typename T>
26142614
inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticValue(const char* utf8name,
26152615
Napi::Value value, napi_property_attributes attributes) {
2616-
napi_property_descriptor desc = {};
2616+
napi_property_descriptor desc = napi_property_descriptor();
26172617
desc.utf8name = utf8name;
26182618
desc.value = value;
26192619
desc.attributes = static_cast<napi_property_attributes>(attributes | napi_static);
@@ -2625,7 +2625,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceValue(
26252625
const char* utf8name,
26262626
Napi::Value value,
26272627
napi_property_attributes attributes) {
2628-
napi_property_descriptor desc = {};
2628+
napi_property_descriptor desc = napi_property_descriptor();
26292629
desc.utf8name = utf8name;
26302630
desc.value = value;
26312631
desc.attributes = attributes;

0 commit comments

Comments
 (0)