Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 1 | # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("clang.gni") |
| 6 | import("//build/config/chromecast_build.gni") |
| 7 | |
| 8 | config("find_bad_constructs") { |
| 9 | if (clang_use_chrome_plugins) { |
| 10 | cflags = [] |
| 11 | |
| 12 | # On Windows, the plugin is built directly into clang, so there's |
| 13 | # no need to load it dynamically. |
| 14 | |
| 15 | if (is_mac || is_ios) { |
| 16 | cflags += [ |
| 17 | "-Xclang", |
| 18 | "-load", |
| 19 | "-Xclang", |
| 20 | rebase_path( |
| 21 | "//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib", |
| 22 | root_build_dir), |
| 23 | ] |
| 24 | } else if (is_linux || is_android) { |
| 25 | cflags += [ |
| 26 | "-Xclang", |
| 27 | "-load", |
| 28 | "-Xclang", |
| 29 | rebase_path( |
| 30 | "//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so", |
| 31 | root_build_dir), |
| 32 | ] |
| 33 | } |
| 34 | |
| 35 | cflags += [ |
| 36 | "-Xclang", |
| 37 | "-add-plugin", |
| 38 | "-Xclang", |
| 39 | "find-bad-constructs", |
| 40 | "-Xclang", |
| 41 | "-plugin-arg-find-bad-constructs", |
| 42 | "-Xclang", |
| 43 | "check-templates", |
| 44 | "-Xclang", |
| 45 | "-plugin-arg-find-bad-constructs", |
| 46 | "-Xclang", |
| 47 | "follow-macro-expansion", |
| 48 | "-Xclang", |
| 49 | "-plugin-arg-find-bad-constructs", |
| 50 | "-Xclang", |
| 51 | "check-implicit-copy-ctors", |
| 52 | ] |
| 53 | |
| 54 | if ((is_linux || is_android) && !is_chromecast) { |
| 55 | cflags += [ |
| 56 | "-Xclang", |
| 57 | "-plugin-arg-find-bad-constructs", |
| 58 | "-Xclang", |
| 59 | "check-ipc", |
| 60 | ] |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | # Enables some extra Clang-specific warnings. Some third-party code won't |
| 66 | # compile with these so may want to remove this config. |
| 67 | config("extra_warnings") { |
| 68 | cflags = [ |
| 69 | "-Wheader-hygiene", |
| 70 | |
| 71 | # Warns when a const char[] is converted to bool. |
| 72 | "-Wstring-conversion", |
| 73 | ] |
| 74 | } |