From 473f55940fa7416127bbe73fbbd0f446abc7e8d1 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 5 Feb 2020 21:10:25 -0800 Subject: [PATCH] Suppress some deprecation warnings on Windows (#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 https://github.com/flutter/flutter/issues/16256 --- fml/BUILD.gn | 5 +++++ shell/platform/common/cpp/BUILD.gn | 5 +++++ third_party/txt/BUILD.gn | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/fml/BUILD.gn b/fml/BUILD.gn index ef0e996da..04ce5527f 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -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", diff --git a/shell/platform/common/cpp/BUILD.gn b/shell/platform/common/cpp/BUILD.gn index 4646e5c68..b4d5b0a5b 100644 --- a/shell/platform/common/cpp/BUILD.gn +++ b/shell/platform/common/cpp/BUILD.gn @@ -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") { diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index 63bf09e44..e3f07f558 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -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) { @@ -296,6 +304,8 @@ executable("txt_unittests") { ] } + configs += [ ":allow_posix_names" ] + deps = [ ":txt", ":txt_test_utils", -- GitLab