Skip to content

Commit e6b3ec3

Browse files
committed
src: do not use posix feature macro in node.h
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]>
1 parent 282e2f6 commit e6b3ec3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/node.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@
6666

6767
#include <memory>
6868

69-
#ifdef __POSIX__
69+
// We cannot use __POSIX__ in this header because that's only defined when
70+
// building Node.js.
71+
#ifndef _WIN32
7072
#include <signal.h>
71-
#endif // __POSIX__
73+
#endif // _WIN32
7274

7375
#define NODE_MAKE_VERSION(major, minor, patch) \
7476
((major) * 0x1000 + (minor) * 0x100 + (patch))
@@ -812,7 +814,7 @@ class NODE_EXTERN AsyncResource {
812814
async_context async_context_;
813815
};
814816

815-
#ifdef __POSIX__
817+
#ifndef _WIN32
816818
// Register a signal handler without interrupting
817819
// any handlers that node itself needs.
818820
NODE_EXTERN
@@ -821,7 +823,7 @@ void RegisterSignalHandler(int signal,
821823
siginfo_t* info,
822824
void* ucontext),
823825
bool reset_handler = false);
824-
#endif // __POSIX__
826+
#endif // _WIN32
825827

826828
} // namespace node
827829

0 commit comments

Comments
 (0)