From 2f4232d5b7e0c99b809b67d9ee30aaff3a7d84a5 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Wed, 9 Mar 2016 09:11:48 -0800 Subject: Support clang-cl build on Windows. R=thakis@chromium.org, tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1774123005 . --- build/standalone.gypi | 46 +++++++++++++++++++++++++++++++++++++++++++++ testing/gtest.gyp | 10 ++++++++++ third_party/third_party.gyp | 13 ++++++++++++- 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/build/standalone.gypi b/build/standalone.gypi index 1e7c0c0dc0..dd3e8e4fe3 100644 --- a/build/standalone.gypi +++ b/build/standalone.gypi @@ -318,6 +318,43 @@ }, { 'WarnAsError': 'true', }], + ['clang==1', { + 'AdditionalOptions': [ + # Don't warn about unused function parameters. + # (This is also used on other platforms.) + '-Wno-unused-parameter', + # Don't warn about the "struct foo f = {0};" initialization + # pattern. + '-Wno-missing-field-initializers', + + # Many files use intrinsics without including this header. + # TODO(hans): Fix those files, or move this to sub-GYPs. + '/FIIntrin.h', + + # TODO(hans): Make this list shorter eventually, http://crbug.com/504657 + '-Qunused-arguments', # http://crbug.com/504658 + '-Wno-microsoft-enum-value', # http://crbug.com/505296 + '-Wno-unknown-pragmas', # http://crbug.com/505314 + '-Wno-microsoft-cast', # http://crbug.com/550065 + + # TODO(ochang): Fix these properly eventually. + '-Wno-inconsistent-missing-override', + ], + }], + ['clang==1 and MSVS_VERSION == "2013"', { + 'VCCLCompilerTool': { + 'AdditionalOptions': [ + '-fmsc-version=1800', + ], + }, + }], + ['clang==1 and MSVS_VERSION == "2015"', { + 'VCCLCompilerTool': { + 'AdditionalOptions': [ + '-fmsc-version=1900', + ], + }, + }], ], }, 'VCLibrarianTool': { @@ -454,6 +491,15 @@ }], ], }], # OS=="linux" or OS=="mac" + ['OS=="win"', { + 'conditions': [ + ['clang==1', { + 'make_global_settings': [ + ['CC', '<(clang_dir)/bin/clang-cl'], + ], + }], + ], + }], # OS=="win" ["use_goma==1", { 'make_global_settings': [ ['CC_wrapper', '<(gomadir)/gomacc'], diff --git a/testing/gtest.gyp b/testing/gtest.gyp index 3c01552c4c..563f340e99 100644 --- a/testing/gtest.gyp +++ b/testing/gtest.gyp @@ -142,6 +142,16 @@ ], 'msvs_disabled_warnings': [4800], }, + 'variables': { + 'clang_warning_flags': [ + # The Mutex constructor initializer list in gtest-port.cc is + # incorrectly ordered. See + # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ. + '-Wno-reorder', + # Suppress warnings for unused constants. + '-Wno-unused' + ], + }, }, { 'target_name': 'gtest_main', diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp index d58c9a71d0..758d23ef0d 100644 --- a/third_party/third_party.gyp +++ b/third_party/third_party.gyp @@ -239,6 +239,12 @@ ], }], ], + 'variables': { + 'clang_warning_flags': [ + # Avoid warning for undefined behaviour. + '-Wno-shift-negative-value', + ], + } }, { 'target_name': 'fx_libopenjpeg', @@ -322,7 +328,12 @@ ], }], ], - + 'variables': { + 'clang_warning_flags': [ + # Avoid warning for undefined behaviour. https://crbug.com/507712 + '-Wno-shift-negative-value', + ] + }, }, { 'target_name': 'pdfium_base', -- cgit v1.2.3