Closed Jbudone closed 4 days ago
@deepak1556 is this just suppressing the warning? I see https://stackoverflow.com/a/66596764/1156119 recommends against it
I would recommend using v8::NonCopyablePersistentTraits instead.
I don't quite understand :see_no_evil: How can I use v8::NonCopyablePersistentTraits here?
I tried changing the type here:
struct pty_baton {
Nan::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function>> cb;
But the warning persists:
make: Entering directory '/home/jbud/repositories/node-pty/build'
CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc: In function ‘void pty_after_waitpid(uv_async_t*)’:
../src/unix/pty.cc:534:9: warning: ‘void* memset(void*, int, size_t)’ writing to an object of type ‘class Nan::Persistent<v8::Function>’ with no trivial copy-assignment [-Wclass-memaccess]
534 | memset(&baton->cb, -1, sizeof(baton->cb));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thing this was fixed with a different PR
Fix non-trivial copy assignment warning in memset usage