Skip to content

Commit

Permalink
src: do not use posix feature macro in node.h
Browse files Browse the repository at this point in the history
This macro is only defined when building Node.js, so addons cannot
use it as a way of detecting feature availability.

PR-URL: #27775
Refs: #27246
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax committed Jun 14, 2019
1 parent 282e2f6 commit e6b3ec3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@

#include <memory>

#ifdef __POSIX__
// We cannot use __POSIX__ in this header because that's only defined when
// building Node.js.
#ifndef _WIN32
#include <signal.h>
#endif // __POSIX__
#endif // _WIN32

#define NODE_MAKE_VERSION(major, minor, patch) \
((major) * 0x1000 + (minor) * 0x100 + (patch))
Expand Down Expand Up @@ -812,7 +814,7 @@ class NODE_EXTERN AsyncResource {
async_context async_context_;
};

#ifdef __POSIX__
#ifndef _WIN32
// Register a signal handler without interrupting
// any handlers that node itself needs.
NODE_EXTERN
Expand All @@ -821,7 +823,7 @@ void RegisterSignalHandler(int signal,
siginfo_t* info,
void* ucontext),
bool reset_handler = false);
#endif // __POSIX__
#endif // _WIN32

} // namespace node

Expand Down

0 comments on commit e6b3ec3

Please sign in to comment.