Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: build/config/compiler/BUILD.gn

Issue 2385643004: Enables GN build on windows (Closed)
Patch Set: Add .gitignore for build Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 88c7c053ff03d7d9b3506ecc7c83e5ab822eccb0..0a86eb4ca57302371ac7d900b06a0c08e4b8431c 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -19,15 +19,6 @@ if (is_win) {
import("//build/toolchain/ccache.gni")
import("//build/config/sanitizers/sanitizers.gni")
-declare_args() {
- if (is_win) {
- # Whether the VS xtree header has been patched to disable warning 4702. If
- # it has, then we don't need to disable 4702 (unreachable code warning).
- # The patch is preapplied to the internal toolchain and hence all bots.
- msvs_xtree_patched = false
- }
-}
-
# default_include_dirs ---------------------------------------------------------
#
# This is a separate config so that third_party code (which would not use the
@@ -40,7 +31,6 @@ config("default_include_dirs") {
]
}
-# TODO(GYP): is_ubsan, is_ubsan_vptr
if (!is_win) {
using_sanitizer = is_asan || is_lsan || is_tsan || is_msan
}
@@ -73,40 +63,6 @@ config("compiler") {
"/GS", # Enable buffer security checking.
"/FS", # Preserve previous PDB behavior.
]
-
- # Building with Clang on Windows is a work in progress and very
- # experimental. See crbug.com/82385.
- # Keep this in sync with the similar block in build/common.gypi
- if (is_clang) {
- cflags += [
- # Many files use intrinsics without including this header.
- # TODO(hans): Fix those files, or move this to sub-GYPs.
- "/FIIntrin.h",
- ]
-
- if (visual_studio_version == "2013") {
- cflags += [ "-fmsc-version=1800" ]
- } else if (visual_studio_version == "2015") {
- cflags += [ "-fmsc-version=1900" ]
- }
-
- if (current_cpu == "x86") {
- cflags += [
- "/fallback",
- "-m32",
- ]
- } else {
- cflags += [ "-m64" ]
- }
- if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
- "True") {
- cflags += [
- # cmd.exe doesn't understand ANSI escape codes by default,
- # so only enable them if something emulating them is around.
- "-fansi-escape-codes",
- ]
- }
- }
} else {
# Common GCC compiler flags setup.
# --------------------------------
@@ -470,9 +426,9 @@ config("compiler_arm_fpu") {
#
# How do you determine what should go in here vs. "compiler" above? Consider if
# a target might choose to use a different runtime library (ignore for a moment
-# if this is possible or reasonable on your system). If such a target would want
-# to change or remove your option, put it in the runtime_library config. If a
-# target wants the option regardless, put it in the compiler config.
+# if this is possible or reasonable on your system). If such a target would
+# want to change or remove your option, put it in the runtime_library config.
+# If a target wants the option regardless, put it in the compiler config.
config("runtime_library") {
cflags = []
@@ -481,30 +437,13 @@ config("runtime_library") {
lib_dirs = []
libs = []
- if (is_component_build) {
- # Component mode: dynamic CRT.
- defines += [ "COMPONENT_BUILD" ]
- if (is_win) {
- # Since the library is shared, it requires exceptions or will give errors
- # about things not matching, so keep exceptions on.
- if (is_debug) {
- cflags += [ "/MDd" ]
- } else {
- cflags += [ "/MD" ]
- }
- }
- } else {
- # Static CRT.
- if (is_win) {
- if (is_debug) {
- cflags += [ "/MTd" ]
- } else {
- cflags += [ "/MT" ]
- }
- }
- }
-
+ # Static CRT.
if (is_win) {
+ if (is_debug) {
+ cflags += [ "/MTd" ]
+ } else {
+ cflags += [ "/MT" ]
+ }
defines += [
"__STD_C",
"_CRT_RAND_S",
@@ -590,108 +529,21 @@ config("runtime_library") {
default_warning_flags = []
default_warning_flags_cc = []
if (is_win) {
- if (!is_clang || current_cpu != "x86") {
+ if (current_cpu != "x86") {
default_warning_flags += [ "/WX" ] # Treat warnings as errors.
}
default_warning_flags += [
- # Warnings permanently disabled:
-
- # TODO(GYP) The GYP build doesn't have this globally enabled but disabled
- # for a bunch of individual targets. Re-enable this globally when those
- # targets are fixed.
- "/wd4018", # Comparing signed and unsigned values.
-
- # C4127: conditional expression is constant
- # This warning can in theory catch dead code and other problems, but
- # triggers in far too many desirable cases where the conditional
- # expression is either set by macros or corresponds some legitimate
- # compile-time constant expression (due to constant template args,
- # conditionals comparing the sizes of different types, etc.). Some of
- # these can be worked around, but it's not worth it.
- "/wd4127",
-
- # C4251: 'identifier' : class 'type' needs to have dll-interface to be
- # used by clients of class 'type2'
- # This is necessary for the shared library build.
- "/wd4251",
-
- # C4351: new behavior: elements of array 'array' will be default
- # initialized
- # This is a silly "warning" that basically just alerts you that the
- # compiler is going to actually follow the language spec like it's
- # supposed to, instead of not following it like old buggy versions did.
- # There's absolutely no reason to turn this on.
- "/wd4351",
-
- # C4355: 'this': used in base member initializer list
- # It's commonly useful to pass |this| to objects in a class' initializer
- # list. While this warning can catch real bugs, most of the time the
- # constructors in question don't attempt to call methods on the passed-in
- # pointer (until later), and annotating every legit usage of this is
- # simply more hassle than the warning is worth.
- "/wd4355",
-
- # C4503: 'identifier': decorated name length exceeded, name was
- # truncated
- # This only means that some long error messages might have truncated
- # identifiers in the presence of lots of templates. It has no effect on
- # program correctness and there's no real reason to waste time trying to
- # prevent it.
- "/wd4503",
-
- # Warning C4589 says: "Constructor of abstract class ignores
- # initializer for virtual base class." Disable this warning because it
- # is flaky in VS 2015 RTM. It triggers on compiler generated
- # copy-constructors in some cases.
- "/wd4589",
-
- # C4611: interaction between 'function' and C++ object destruction is
- # non-portable
- # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
- # suggests using exceptions instead of setjmp/longjmp for C++, but
- # Chromium code compiles without exception support. We therefore have to
- # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
- # have to turn off this warning (and be careful about how object
- # destruction happens in such cases).
- "/wd4611",
-
- # Warnings to evaluate and possibly fix/reenable later:
-
- "/wd4100", # Unreferenced formal function parameter.
- "/wd4121", # Alignment of a member was sensitive to packing.
- "/wd4244", # Conversion: possible loss of data.
- "/wd4481", # Nonstandard extension: override specifier.
- "/wd4505", # Unreferenced local function has been removed.
- "/wd4510", # Default constructor could not be generated.
- "/wd4512", # Assignment operator could not be generated.
- "/wd4610", # Class can never be instantiated, constructor required.
- "/wd4996", # Deprecated function warning.
+ # Permanent.
+ "/wd4091", # typedef warning from dbghelp.h
+ # Investigate.
+ "/wd4312", # int to pointer of greater size conversion.
+ "/wd4838", # Narrowing conversion required.
+ "/wd4172", # Returning address of local.
+ "/wd4005", # Redefinition of macros for PRId64 etc.
+ "/wd4311", # Pointer truncation from PVOID to DWORD.
+ "/wd4477", # Format string requires wchar_t*
]
-
- # VS xtree header file needs to be patched or 4702 (unreachable code
- # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is
- # not patched.
- if (!msvs_xtree_patched &&
- exec_script("../../win_is_xtree_patched.py", [], "value") == 0) {
- default_warning_flags += [ "/wd4702" ] # Unreachable code.
- }
-
- # Building with Clang on Windows is a work in progress and very
- # experimental. See crbug.com/82385.
- # Keep this in sync with the similar block in build/common.gypi
- if (is_clang) {
- default_warning_flags += [
- # TODO(hans): Make this list shorter eventually, http://crbug.com/504657
- "-Qunused-arguments", # http://crbug.com/504658
- "-Wno-microsoft", # http://crbug.com/505296
- "-Wno-switch", # http://crbug.com/505308
- "-Wno-unknown-pragmas", # http://crbug.com/505314
- "-Wno-unused-function", # http://crbug.com/505316
- "-Wno-unused-value", # http://crbug.com/505318
- "-Wno-unused-local-typedef", # http://crbug.com/411648
- ]
- }
} else {
# Common GCC warning setup.
default_warning_flags += [
@@ -757,7 +609,9 @@ if (is_win) {
config("chromium_code") {
if (is_win) {
- cflags = [ "/W4" ] # Warning level 4.
+ # TODO(zra): Enable higher warning levels.
+ # cflags = [ "/W4" ] # Warning level 4.
+ cflags = []
} else {
cflags = [
"-Wall",
@@ -787,12 +641,6 @@ config("no_chromium_code") {
defines = []
if (is_win) {
- cflags += [
- "/W3", # Warning level 3.
- "/wd4800", # Disable warning when forcing value to bool.
- "/wd4267", # TODO(jschuh): size_t to int.
- "/wd4996", # Deprecated function warning.
- ]
defines += [
"_CRT_NONSTDC_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | build/config/win/BUILD.gn » ('j') | utils/invoke_dart.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698