Skip to content

Commit cb79362

Browse files
isheludkovictorgomes
authored andcommitted
Add node_enable_deprecated_declarations_warnings GN flag (nodejs#181)
* Add node_enable_deprecated_declarations_warnings GN flag Warnings about using deprecated declarations were disabled by default which made it hard to ensure that Node doesn't use V8's deprecated Apis. The flag allows enabling deprecated warnings and suppresses (hopefully) known issues with using deprecated functionality in c-api. The flag is off by default which preserves the existing behavior. Drive-by: fix deps/openssl/unofficial.gni by exposing the required OpenSSL compatibility level (OPENSSL_API_COMPAT) via public_configs.
1 parent 1fe3f0e commit cb79362

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

deps/openssl/unofficial.gni

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ template("openssl_gn_build") {
1616
"openssl/crypto/include",
1717
"openssl/include",
1818
]
19+
defines = [ "OPENSSL_API_COMPAT=0x10100001L" ]
1920
}
2021

2122
config("openssl_internal_config") {
@@ -26,7 +27,6 @@ template("openssl_gn_build") {
2627

2728
defines = [
2829
"MODULESDIR=\"deps/openssl/lib/openssl-modules\"",
29-
"OPENSSL_API_COMPAT=0x10100001L",
3030
"STATIC_LEGACY",
3131
] + gypi_values.openssl_default_defines_all
3232
if (is_win) {

unofficial.gni

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import("node.gni")
66
import("$node_v8_path/gni/snapshot_toolchain.gni")
77
import("$node_v8_path/gni/v8.gni")
88

9+
declare_args() {
10+
# Enable warnings about usages of deprecated declarations and suppress
11+
# known issues with c-ares.
12+
node_enable_deprecated_declarations_warnings = false
13+
}
14+
915
# The actual configurations are put inside a template in unofficial.gni to
1016
# prevent accidental edits from contributors.
1117
template("node_gn_build") {
@@ -33,7 +39,7 @@ template("node_gn_build") {
3339
defines += [ "HAVE_INSPECTOR=0" ]
3440
}
3541
if (node_use_node_code_cache) {
36-
defines += [ "NODE_USE_NODE_CODE_CACHE=1"]
42+
defines += [ "NODE_USE_NODE_CODE_CACHE=1" ]
3743
}
3844
if (v8_enable_i18n_support) {
3945
defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
@@ -64,7 +70,6 @@ template("node_gn_build") {
6470
libs = []
6571
cflags = [ "-Wno-microsoft-include" ]
6672
cflags_cc = [
67-
"-Wno-deprecated-declarations",
6873
"-Wno-extra-semi",
6974
"-Wno-implicit-fallthrough",
7075
"-Wno-macro-redefined",
@@ -82,6 +87,10 @@ template("node_gn_build") {
8287
"-Wno-unused-function",
8388
]
8489

90+
if (!node_enable_deprecated_declarations_warnings) {
91+
cflags_cc += [ "-Wno-deprecated-declarations" ]
92+
}
93+
8594
if (current_cpu == "x86") {
8695
node_arch = "ia32"
8796
} else {
@@ -100,6 +109,11 @@ template("node_gn_build") {
100109
"NODE_REPORT"
101110
]
102111

112+
if (node_enable_deprecated_declarations_warnings) {
113+
# Refs: https://github.com/nodejs/node/issues/52464
114+
defines += [ "CARES_NO_DEPRECATED=1" ]
115+
}
116+
103117
if (is_win) {
104118
defines += [
105119
"NOMINMAX",

0 commit comments

Comments
 (0)