GeezerVison is showing github.com — src: move Node-API version detection to where it is used · nodejs/node@de78da7
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/js_native_api.h -28Lines changed: 0 additions & 28 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
5 | 5 | #include <stdbool.h> // NOLINT(modernize-deprecated-headers) |
6 | 6 | #include <stddef.h> // NOLINT(modernize-deprecated-headers) |
7 | 7 |
|
8 | | -// Use INT_MAX, this should only be consumed by the pre-processor anyway. |
9 | | -#define NAPI_VERSION_EXPERIMENTAL 2147483647 |
10 | | -#ifndef NAPI_VERSION |
11 | | -#ifdef NAPI_EXPERIMENTAL |
12 | | -#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL |
13 | | -#else |
14 | | -// The baseline version for N-API. |
15 | | -// The NAPI_VERSION controls which version will be used by default when |
16 | | -// compilling a native addon. If the addon developer specifically wants to use |
17 | | -// functions available in a new version of N-API that is not yet ported in all |
18 | | -// LTS versions, they can set NAPI_VERSION knowing that they have specifically |
19 | | -// depended on that version. |
20 | | -#define NAPI_VERSION 8 |
21 | | -#endif |
22 | | -#endif |
23 | | - |
24 | | -#if defined(NAPI_EXPERIMENTAL) && \ |
25 | | - !defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \ |
26 | | - !defined(NODE_WANT_INTERNALS) |
27 | | -#ifdef _MSC_VER |
28 | | -#pragma message("NAPI_EXPERIMENTAL is enabled. " \ |
29 | | - "Experimental features may be unstable.") |
30 | | -#else |
31 | | -#warning "NAPI_EXPERIMENTAL is enabled. " \ |
32 | | - "Experimental features may be unstable." |
33 | | -#endif |
34 | | -#endif |
35 | | - |
36 | 8 | #include "js_native_api_types.h" |
37 | 9 |
|
38 | 10 | // If you need __declspec(dllimport), either include <node_api.h> instead, or |
|
Collapse file
Copy file name to clipboardExpand all lines: src/js_native_api_types.h +28Lines changed: 28 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | #ifndef SRC_JS_NATIVE_API_TYPES_H_ |
2 | 2 | #define SRC_JS_NATIVE_API_TYPES_H_ |
3 | 3 |
|
| 4 | +// Use INT_MAX, this should only be consumed by the pre-processor anyway. |
| 5 | +#define NAPI_VERSION_EXPERIMENTAL 2147483647 |
| 6 | +#ifndef NAPI_VERSION |
| 7 | +#ifdef NAPI_EXPERIMENTAL |
| 8 | +#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL |
| 9 | +#else |
| 10 | +// The baseline version for N-API. |
| 11 | +// The NAPI_VERSION controls which version will be used by default when |
| 12 | +// compilling a native addon. If the addon developer specifically wants to use |
| 13 | +// functions available in a new version of N-API that is not yet ported in all |
| 14 | +// LTS versions, they can set NAPI_VERSION knowing that they have specifically |
| 15 | +// depended on that version. |
| 16 | +#define NAPI_VERSION 8 |
| 17 | +#endif |
| 18 | +#endif |
| 19 | + |
| 20 | +#if defined(NAPI_EXPERIMENTAL) && \ |
| 21 | + !defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \ |
| 22 | + !defined(NODE_WANT_INTERNALS) |
| 23 | +#ifdef _MSC_VER |
| 24 | +#pragma message("NAPI_EXPERIMENTAL is enabled. " \ |
| 25 | + "Experimental features may be unstable.") |
| 26 | +#else |
| 27 | +#warning "NAPI_EXPERIMENTAL is enabled. " \ |
| 28 | + "Experimental features may be unstable." |
| 29 | +#endif |
| 30 | +#endif |
| 31 | + |
4 | 32 | // This file needs to be compatible with C compilers. |
5 | 33 | // This is a public include file, and these includes have essentially |
6 | 34 | // became part of it's API. |
|