Skip to content

Commit

Permalink
Fix warnings when running npm test
Browse files Browse the repository at this point in the history
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.

This change is fixing nodejs#164 issue.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489
  • Loading branch information
romandev committed Oct 27, 2017
1 parent 988c9a9 commit 53f8695
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticMethod(
// TODO: Delete when the class is destroyed
StaticVoidMethodCallbackData* callbackData = new StaticVoidMethodCallbackData({ method, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = T::StaticVoidMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2451,7 +2451,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticMethod(
// TODO: Delete when the class is destroyed
StaticMethodCallbackData* callbackData = new StaticMethodCallbackData({ method, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = T::StaticMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2470,7 +2470,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticAccessor(
StaticAccessorCallbackData* callbackData =
new StaticAccessorCallbackData({ getter, setter, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.getter = getter != nullptr ? T::StaticGetterCallbackWrapper : nullptr;
desc.setter = setter != nullptr ? T::StaticSetterCallbackWrapper : nullptr;
Expand All @@ -2489,7 +2489,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
InstanceVoidMethodCallbackData* callbackData =
new InstanceVoidMethodCallbackData({ method, data});

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = T::InstanceVoidMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2506,7 +2506,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
// TODO: Delete when the class is destroyed
InstanceMethodCallbackData* callbackData = new InstanceMethodCallbackData({ method, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.method = T::InstanceMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2524,7 +2524,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
InstanceVoidMethodCallbackData* callbackData =
new InstanceVoidMethodCallbackData({ method, data});

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.name = name;
desc.method = T::InstanceVoidMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2541,7 +2541,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceMethod(
// TODO: Delete when the class is destroyed
InstanceMethodCallbackData* callbackData = new InstanceMethodCallbackData({ method, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.name = name;
desc.method = T::InstanceMethodCallbackWrapper;
desc.data = callbackData;
Expand All @@ -2560,7 +2560,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceAccessor(
InstanceAccessorCallbackData* callbackData =
new InstanceAccessorCallbackData({ getter, setter, data });

napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.getter = getter != nullptr ? T::InstanceGetterCallbackWrapper : nullptr;
desc.setter = setter != nullptr ? T::InstanceSetterCallbackWrapper : nullptr;
Expand All @@ -2572,7 +2572,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceAccessor(
template <typename T>
inline ClassPropertyDescriptor<T> ObjectWrap<T>::StaticValue(const char* utf8name,
Napi::Value value, napi_property_attributes attributes) {
napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.value = value;
desc.attributes = static_cast<napi_property_attributes>(attributes | napi_static);
Expand All @@ -2584,7 +2584,7 @@ inline ClassPropertyDescriptor<T> ObjectWrap<T>::InstanceValue(
const char* utf8name,
Napi::Value value,
napi_property_attributes attributes) {
napi_property_descriptor desc = {};
napi_property_descriptor desc = napi_property_descriptor();
desc.utf8name = utf8name;
desc.value = value;
desc.attributes = attributes;
Expand Down

0 comments on commit 53f8695

Please sign in to comment.