From: Nico Weber Date: Fri, 25 Jan 2019 00:29:17 +0000 (+0000) Subject: gn build: Build clang with -fno-strict-aliasing, make building with gcc much quieter X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1206b71c5a869ff4c9cfc4b3c066b07f1b8e0225;p=llvm gn build: Build clang with -fno-strict-aliasing, make building with gcc much quieter - gcc doesn't understand -Wstring-conversion, so pass that only to clang - disable a few gcc warnings that are noisy and also disabled in the cmake build - -Wstrict-aliasing pointed out that the cmake build builds clang with -fno-strict-aliasing, so do that too Differential Revision: https://reviews.llvm.org/D57191 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352141 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/gn/build/BUILD.gn b/utils/gn/build/BUILD.gn index e5c8d2a6209..18e25827aaf 100644 --- a/utils/gn/build/BUILD.gn +++ b/utils/gn/build/BUILD.gn @@ -93,12 +93,27 @@ config("compiler_defaults") { "-Wextra", ] } - cflags += [ - "-Wno-unused-parameter", - "-Wstring-conversion", - ] + cflags += [ "-Wno-unused-parameter" ] if (is_clang) { - cflags += [ "-Wdelete-non-virtual-dtor" ] + cflags += [ + "-Wdelete-non-virtual-dtor", + "-Wstring-conversion", + ] + } else { + cflags += [ + # GCC's -Wcomment complains about // comments ending with '\' if the + # next line is also a // comment. + "-Wno-comment", + + # Disable gcc's potentially uninitialized use analysis as it presents + # lots of false positives. + "-Wno-maybe-uninitialized", + ] + cflags_cc += [ + # The LLVM libraries have no stable C++ API, so -Wnoexcept-type is not + # useful. + "-Wno-noexcept-type", + ] } if (is_clang && use_goma) { # goma converts all paths to lowercase on the server, breaking this @@ -135,6 +150,9 @@ config("lld_code") { } config("clang_code") { + if (host_os != "win") { + cflags = [ "-fno-strict-aliasing" ] + } include_dirs = [ "//clang/include", "$root_gen_dir/clang/include",