• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5import("clang.gni")
6
7config("find_bad_constructs") {
8  if (clang_use_chrome_plugins) {
9    cflags = []
10
11    # On Windows, the plugin is built directly into clang, so there's
12    # no need to load it dynamically.
13    if (host_os == "mac") {
14      cflags += [
15        "-Xclang",
16        "-load",
17        "-Xclang",
18        rebase_path("${clang_base_path}/lib/libFindBadConstructs.dylib",
19                    root_build_dir),
20      ]
21    } else if (host_os == "linux") {
22      cflags += [
23        "-Xclang",
24        "-load",
25        "-Xclang",
26        rebase_path("${clang_base_path}/lib/libFindBadConstructs.so",
27                    root_build_dir),
28      ]
29    }
30
31    cflags += [
32      "-Xclang",
33      "-add-plugin",
34      "-Xclang",
35      "find-bad-constructs",
36    ]
37
38    cflags += [
39      "-Xclang",
40      "-plugin-arg-find-bad-constructs",
41      "-Xclang",
42      "enforce-in-thirdparty-webkit",
43    ]
44
45    cflags += [
46      "-Xclang",
47      "-plugin-arg-find-bad-constructs",
48      "-Xclang",
49      "check-enum-max-value",
50    ]
51
52    if (is_linux || is_ohos) {
53      cflags += [
54        "-Xclang",
55        "-plugin-arg-find-bad-constructs",
56        "-Xclang",
57        "check-ipc",
58      ]
59    }
60  }
61}
62
63# Enables some extra Clang-specific warnings. Some third-party code won't
64# compile with these so may want to remove this config.
65config("extra_warnings") {
66  cflags = [
67    "-Wheader-hygiene",
68
69    # Warns when a const char[] is converted to bool.
70    "-Wstring-conversion",
71    "-Wtautological-overlap-compare",
72  ]
73}
74