Skip to content

Commit d222859

Browse files
isheludkovictorgomes
authored andcommitted
Add node_enable_deprecated_declarations_warnings GN flag (#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 0f203b3 commit d222859

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") {
@@ -43,7 +49,7 @@ template("node_gn_build") {
4349
defines += [ "HAVE_INSPECTOR=0" ]
4450
}
4551
if (node_use_node_code_cache) {
46-
defines += [ "NODE_USE_NODE_CODE_CACHE=1"]
52+
defines += [ "NODE_USE_NODE_CODE_CACHE=1" ]
4753
}
4854
if (v8_enable_i18n_support) {
4955
defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
@@ -74,7 +80,6 @@ template("node_gn_build") {
7480
libs = []
7581
cflags = [ "-Wno-microsoft-include" ]
7682
cflags_cc = [
77-
"-Wno-deprecated-declarations",
7883
"-Wno-extra-semi",
7984
"-Wno-implicit-fallthrough",
8085
"-Wno-macro-redefined",
@@ -94,6 +99,10 @@ template("node_gn_build") {
9499
"-Wno-unused-function",
95100
]
96101

102+
if (!node_enable_deprecated_declarations_warnings) {
103+
cflags_cc += [ "-Wno-deprecated-declarations" ]
104+
}
105+
97106
if (current_cpu == "x86") {
98107
node_arch = "ia32"
99108
} else {
@@ -112,6 +121,11 @@ template("node_gn_build") {
112121
"NODE_REPORT"
113122
]
114123

124+
if (node_enable_deprecated_declarations_warnings) {
125+
# Refs: https://github.com/nodejs/node/issues/52464
126+
defines += [ "CARES_NO_DEPRECATED=1" ]
127+
}
128+
115129
if (is_win) {
116130
defines += [
117131
"NOMINMAX",

0 commit comments

Comments
 (0)