Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 164b97d26260f3e238834c36ffad1e9e53037f5c..584f72be2e30c6277aa04d6d005b788137e55d06 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -881,6 +881,20 @@ config("wexit_time_destructors") { |
} |
} |
+# On Windows compiling on x64, VC will issue a warning when converting |
+# size_t to int because it will truncate the value. Our code should not have |
+# these warnings and one should use a static_cast or a checked_cast for the |
+# conversion depending on the case. However, a lot of code still needs to be |
+# fixed. Apply this config to such targets to disable the warning. |
+# |
+# Note that this can be applied regardless of platform and architecture to |
+# clean up the call sites. This will only apply the flag when necessary. |
+config("no_size_t_to_int_warning") { |
+ if (is_win && cpu_arch == "x64") { |
+ cflags = [ "/wd4267" ] |
+ } |
+} |
+ |
# Optimization ----------------------------------------------------------------- |
# |
# Note that BUILDCONFIG.gn sets up a variable "default_optimization_config" |