Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated warning with nan v2.7.0 and Node.js 9.0.0 #707

Closed
fivdi opened this issue Oct 31, 2017 · 5 comments
Closed

Deprecated warning with nan v2.7.0 and Node.js 9.0.0 #707

fivdi opened this issue Oct 31, 2017 · 5 comments

Comments

@fivdi
Copy link

fivdi commented Oct 31, 2017

When a native module using nan v2.7.0 is installed with Node.js 9.0.0 there is a deprecated warning. For example, here's the warning shown when installing the epoll module:

pi@raspberrypi:~/epoll $ npm i epoll

> epoll@1.0.0 install /home/pi/epoll/node_modules/epoll
> node-gyp rebuild

make: Entering directory '/home/pi/epoll/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/epoll.cc:15:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
In file included from /home/pi/.node-gyp/9.0.0/include/node/v8.h:26:0,
                 from ../src/epoll.cc:11:
/home/pi/.node-gyp/9.0.0/include/node/v8.h:3115:29: note: declared here
                 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
                             ^
/home/pi/.node-gyp/9.0.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/home/pi/epoll/node_modules/epoll/build'
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/epoll/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/epoll/package.json'
npm WARN epoll No description
npm WARN epoll No repository field.
npm WARN epoll No README data
npm WARN epoll No license field.

+ epoll@1.0.0
added 3 packages in 10.643s
pi@raspberrypi:~/epoll $ 
@kkoopa
Copy link
Collaborator

kkoopa commented Oct 31, 2017

That is unfortunate. It was only a question of time. ForceSet has been on its way out in V8 for a long time, but if I remember correctly there is no proper alternative, so the fix is not straightforward, if at all possible. Neither CreateDataProperty not DefineOwnProperty offer the same semantics.
Related: #504

@fivdi
Copy link
Author

fivdi commented Nov 4, 2017

If I understand PR #708 correctly, the plan is leave Nan::ForceSet as it is, mark it as deprecated and introduce Nan::DefineOwnProperty.

V8 already has v8::Object::ForceSet marked as deprecated. This results in the deprecation warning shown in the above post irrespective of whether Nan::ForceSet is used by an addon or not.

So if I want to suppress the V8 deprecation warning for v8::Object::ForceSet I'll have to suppress it in my addon because NAN will not be suppressing it, is this correct?

@bnoordhuis
Copy link
Member

@fivdi Yes, correct.

@kkoopa
Copy link
Collaborator

kkoopa commented Nov 4, 2017 via email

sorccu added a commit to sorccu/node-socket-activation that referenced this issue Nov 7, 2017
… deprecation warning when building on 9.x.
@kkoopa
Copy link
Collaborator

kkoopa commented Nov 10, 2017

Fixed in master. New release coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants