Skip to content

Commit 473f559

Browse files
Suppress some deprecation warnings on Windows (flutter#16416)
Targeted suppression of some deprecation warnings that are build errors under clang: - Ignore the deprecation of codecvt's unicode conversion until we decide on a replacement strategy. - Allow the deprecated posix names of functions in third_party/txt. Part of flutter#16256
1 parent f25d325 commit 473f559

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

fml/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ source_set("fml") {
202202
"platform/win/paths_win.cc",
203203
"platform/win/wstring_conversion.h",
204204
]
205+
206+
if (is_win) {
207+
# For wstring_conversion. See issue #50053.
208+
defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ]
209+
}
205210
} else {
206211
sources += [
207212
"platform/posix/file_posix.cc",

shell/platform/common/cpp/BUILD.gn

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ source_set("common_cpp") {
5353
# won't have a JSON dependency.
5454
defines = [ "USE_RAPID_JSON" ]
5555
deps += [ "//third_party/rapidjson" ]
56+
57+
if (is_win) {
58+
# For wstring_conversion. See issue #50053.
59+
defines += [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ]
60+
}
5661
}
5762

5863
copy("publish_headers") {

third_party/txt/BUILD.gn

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ config("txt_config") {
2828
include_dirs = [ "src" ]
2929
}
3030

31+
config("allow_posix_names") {
32+
if (is_win && is_clang) {
33+
# POSIX names of many functions are marked deprecated by default;
34+
# disable that since they are used for cross-platform compatibility.
35+
defines = [ "_CRT_NONSTDC_NO_DEPRECATE" ]
36+
}
37+
}
38+
3139
source_set("txt") {
3240
defines = []
3341
if (flutter_use_fontconfig) {
@@ -296,6 +304,8 @@ executable("txt_unittests") {
296304
]
297305
}
298306

307+
configs += [ ":allow_posix_names" ]
308+
299309
deps = [
300310
":txt",
301311
":txt_test_utils",

0 commit comments

Comments
 (0)