Support for building Chrome using Clang.
To build, set the clang=1 gyp_define.
This patch is the culmination of many months of effort and many
patches. It contains the minimal changes to Chrome that
are Clang-specific.
With this, I can build the "chrome" target. Once this patch
is in, we can incrementally fix bits of Chrome and various
tests and remove the Clang-specific workarounds.
Review URL: http://codereview.chromium.org/522020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59882 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/build/common.gypi b/build/common.gypi
index 0f721ed..d81c567 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -251,6 +251,12 @@
# Set this to true to enable SELinux support.
'selinux%': 0,
+ # Set this to true when building with Clang.
+ # See http://code.google.com/p/chromium/wiki/Clang for details.
+ # TODO: eventually clang should behave identically to gcc, and this
+ # won't be necessary.
+ 'clang%': 0,
+
# Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
'linux_breakpad%': 0,
# And if we want to dump symbols for Breakpad-enabled builds.
@@ -1114,6 +1120,23 @@
],
}]]
}],
+ ['clang==1', {
+ 'cflags': [
+ # Don't warn about unused variables, due to a common pattern:
+ # scoped_deleter unused_variable(&thing_to_delete);
+ '-Wno-unused-variable',
+ # Clang spots more unused functions.
+ '-Wno-unused-function',
+ # gtest confuses clang.
+ '-Wno-bool-conversions',
+ # Don't die on dtoa code that uses a char as an array index.
+ '-Wno-char-subscripts',
+ ],
+ 'cflags!': [
+ # Clang doesn't seem to know know this flag.
+ '-mfpmath=sse',
+ ],
+ }],
['no_strict_aliasing==1', {
'cflags': [
'-fno-strict-aliasing',