Skip to content

Commit

Permalink
Suppress some deprecation warnings on Windows (flutter#16416)
Browse files Browse the repository at this point in the history
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/flutter#16256
  • Loading branch information
stuartmorgan authored Feb 6, 2020
1 parent f25d325 commit 473f559
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ source_set("fml") {
"platform/win/paths_win.cc",
"platform/win/wstring_conversion.h",
]

if (is_win) {
# For wstring_conversion. See issue #50053.
defines = [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ]
}
} else {
sources += [
"platform/posix/file_posix.cc",
Expand Down
5 changes: 5 additions & 0 deletions shell/platform/common/cpp/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ source_set("common_cpp") {
# won't have a JSON dependency.
defines = [ "USE_RAPID_JSON" ]
deps += [ "//third_party/rapidjson" ]

if (is_win) {
# For wstring_conversion. See issue #50053.
defines += [ "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING" ]
}
}

copy("publish_headers") {
Expand Down
10 changes: 10 additions & 0 deletions third_party/txt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ config("txt_config") {
include_dirs = [ "src" ]
}

config("allow_posix_names") {
if (is_win && is_clang) {
# POSIX names of many functions are marked deprecated by default;
# disable that since they are used for cross-platform compatibility.
defines = [ "_CRT_NONSTDC_NO_DEPRECATE" ]
}
}

source_set("txt") {
defines = []
if (flutter_use_fontconfig) {
Expand Down Expand Up @@ -296,6 +304,8 @@ executable("txt_unittests") {
]
}

configs += [ ":allow_posix_names" ]

deps = [
":txt",
":txt_test_utils",
Expand Down

0 comments on commit 473f559

Please sign in to comment.