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

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

Issue 1158763006: clang/win: Start work on getting clang/win working in gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 7 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
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | build/toolchain/win/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 30872ae61d1bd5a592eb54e2185d586e4144a3af..f2c15264d842131c5393f17e585f195f174023f9 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -102,6 +102,27 @@ 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 += [
+ "-fmsc-version=1800",
+
+ # Many files use intrinsics without including this header.
+ # TODO(hans): Fix those files, or move this to sub-GYPs.
+ "/FIIntrin.h",
+ ]
+ if (current_cpu == "x86") {
+ cflags += [
+ "/fallback",
+ "-m32",
+ ]
+ } else {
+ cflags += [ "-m64" ]
+ }
+ }
} else {
# Common GCC compiler flags setup.
# --------------------------------
@@ -773,9 +794,13 @@ config("no_rtti") {
config("default_warnings") {
if (is_win) {
- cflags = [
- "/WX", # Treat warnings as errors.
+ cflags = []
+
+ if (!is_clang || current_cpu != "x86") {
+ cflags += [ "/WX" ] # Treat warnings as errors.
+ }
+ cflags += [
# Warnings permanently disabled:
# TODO(GYP) The GYP build doesn't have this globally enabled but disabled
@@ -851,6 +876,48 @@ config("default_warnings") {
exec_script("../../win_is_xtree_patched.py", [], "value") == 0) {
cflags += [ "/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) {
+ cflags += [
+ # TODO(hans): Make this list shorter eventually.
+ "-Qunused-arguments",
+ "-Wno-c++11-compat-deprecated-writable-strings",
+ "-Wno-deprecated-declarations",
+ "-Wno-empty-body",
+ "-Wno-enum-conversion",
+ "-Wno-extra-tokens",
+ "-Wno-ignored-attributes",
+ "-Wno-incompatible-pointer-types",
+ "-Wno-int-to-void-pointer-cast",
+ "-Wno-invalid-noreturn",
+ "-Wno-logical-op-parentheses",
+ "-Wno-microsoft",
+ "-Wno-missing-braces",
+ "-Wno-missing-declarations",
+ "-Wno-msvc-include",
+ "-Wno-null-dereference",
+ "-Wno-overloaded-virtual",
+ "-Wno-parentheses",
+ "-Wno-pointer-sign",
+ "-Wno-reorder",
+ "-Wno-return-type-c-linkage",
+ "-Wno-self-assign",
+ "-Wno-sometimes-uninitialized",
+ "-Wno-switch",
+ "-Wno-tautological-compare",
+ "-Wno-unknown-pragmas",
+ "-Wno-unsequenced",
+ "-Wno-unused-function",
+ "-Wno-unused-private-field",
+ "-Wno-unused-value",
+ "-Wno-unused-variable",
+ "-Wno-unused-local-typedef", # http://crbug.com/411648
+ "-Wno-inconsistent-missing-override", #http://crbug.com/428099
+ ]
+ }
} else {
# Common GCC warning setup.
cflags = [
@@ -874,48 +941,6 @@ config("default_warnings") {
}
}
- if (is_clang) {
- cflags += [
- # This warns on using ints as initializers for floats in
- # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
- # which happens in several places in chrome code. Not sure if
- # this is worth fixing.
- "-Wno-c++11-narrowing",
-
- # Don't die on dtoa code that uses a char as an array index.
- # This is required solely for base/third_party/dmg_fp/dtoa.cc.
- # TODO(brettw) move this to that project then!
- "-Wno-char-subscripts",
-
- # Warns on switches on enums that cover all enum values but
- # also contain a default: branch. Chrome is full of that.
- "-Wno-covered-switch-default",
-
- # Clang considers the `register` keyword as deprecated, but e.g.
- # code generated by flex (used in angle) contains that keyword.
- # http://crbug.com/255186
- "-Wno-deprecated-register",
-
- # TODO(thakis): This used to be implied by -Wno-unused-function,
- # which we no longer use. Check if it makes sense to remove
- # this as well. http://crbug.com/316352
- "-Wno-unneeded-internal-declaration",
-
- # TODO(thakis): Remove, http://crbug.com/263960
- "-Wno-reserved-user-defined-literal",
- ]
-
- # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
- # always have different versions. Certain flags may not be recognized by
- # one version or the other.
- if (!is_nacl) {
- # Flags NaCl does not recognize.
- cflags += [
- # TODO(hans): Get this cleaned up.
- "-Wno-inconsistent-missing-override",
- ]
- }
- }
if (gcc_version >= 48) {
cflags_cc += [
# See comment for -Wno-c++11-narrowing.
@@ -961,13 +986,57 @@ config("default_warnings") {
cflags += [ "-Wno-unused-local-typedefs" ]
}
}
+
+ if (is_clang) {
+ cflags += [
+ # This warns on using ints as initializers for floats in
+ # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
+ # which happens in several places in chrome code. Not sure if
+ # this is worth fixing.
+ "-Wno-c++11-narrowing",
+
+ # Don't die on dtoa code that uses a char as an array index.
+ # This is required solely for base/third_party/dmg_fp/dtoa.cc.
+ # TODO(brettw) move this to that project then!
+ "-Wno-char-subscripts",
+
+ # Warns on switches on enums that cover all enum values but
+ # also contain a default: branch. Chrome is full of that.
+ "-Wno-covered-switch-default",
+
+ # Clang considers the `register` keyword as deprecated, but e.g.
+ # code generated by flex (used in angle) contains that keyword.
+ # http://crbug.com/255186
+ "-Wno-deprecated-register",
+
+ # TODO(thakis): This used to be implied by -Wno-unused-function,
+ # which we no longer use. Check if it makes sense to remove
+ # this as well. http://crbug.com/316352
+ "-Wno-unneeded-internal-declaration",
+
+ # TODO(thakis): Remove, http://crbug.com/263960
+ "-Wno-reserved-user-defined-literal",
+ ]
+
+ # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
+ # always have different versions. Certain flags may not be recognized by
+ # one version or the other.
+ if (!is_nacl) {
+ # Flags NaCl does not recognize.
+ cflags += [
+ # TODO(hans): Get this cleaned up.
+ "-Wno-inconsistent-missing-override",
+ ]
+ }
+ }
}
# This will generate warnings when using Clang if code generates exit-time
# destructors, which will slow down closing the program.
# TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
config("wexit_time_destructors") {
- if (is_clang) {
+ # TODO: Enable on Windows too, http://crbug.com/404525
+ if (is_clang && !is_win) {
cflags = [ "-Wexit-time-destructors" ]
}
}
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | build/toolchain/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698