2013-11-21 02:21:03 +04:00
|
|
|
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2014-04-24 20:44:04 +04:00
|
|
|
import("clang.gni")
|
Check IPC messages for banned types on Android.
This change enables check-ipc option for find-bad-constructs Clang
plugin on Android. With that option Clang plugin will check that the
following types are not used in IPC messages:
1. Types: long / unsigned long (but not typedefs to)
2. Typedefs: intmax_t, uintmax_t, intptr_t, uintptr_t, wint_t, size_t,
rsize_t, ssize_t, ptrdiff_t, dev_t, off_t, clock_t, time_t, suseconds_t
(including typedefs to)
3. Any template referencing the above (e.g. std::vector<size_t>)
These types are banned because they are not stable across 32/64-bit platforms.
BUG=581409
Review URL: https://codereview.chromium.org/1904553002
Cr-Original-Commit-Position: refs/heads/master@{#389850}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 972c22efaddb8a541351329c9e7609d04d75b95f
2016-04-26 22:34:17 +03:00
|
|
|
import("//build/config/chromecast_build.gni")
|
2014-01-18 00:34:06 +04:00
|
|
|
|
2013-11-21 02:21:03 +04:00
|
|
|
config("find_bad_constructs") {
|
2014-01-18 00:34:06 +04:00
|
|
|
if (clang_use_chrome_plugins) {
|
2015-04-16 20:28:50 +03:00
|
|
|
cflags = []
|
|
|
|
|
|
|
|
# On Windows, the plugin is built directly into clang, so there's
|
|
|
|
# no need to load it dynamically.
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-01-27 11:41:23 +04:00
|
|
|
if (is_mac || is_ios) {
|
2015-04-16 20:28:50 +03:00
|
|
|
cflags += [
|
|
|
|
"-Xclang",
|
|
|
|
"-load",
|
|
|
|
"-Xclang",
|
2016-06-23 09:31:52 +03:00
|
|
|
rebase_path("${clang_base_path}/lib/libFindBadConstructs.dylib",
|
|
|
|
root_build_dir),
|
2015-04-16 20:28:50 +03:00
|
|
|
]
|
2016-03-14 22:23:49 +03:00
|
|
|
} else if (is_linux || is_android) {
|
2015-04-16 20:28:50 +03:00
|
|
|
cflags += [
|
|
|
|
"-Xclang",
|
|
|
|
"-load",
|
|
|
|
"-Xclang",
|
2016-06-23 09:31:52 +03:00
|
|
|
rebase_path("${clang_base_path}/lib/libFindBadConstructs.so",
|
|
|
|
root_build_dir),
|
2015-04-16 20:28:50 +03:00
|
|
|
]
|
2014-01-18 00:34:06 +04:00
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
|
2014-01-18 00:34:06 +04:00
|
|
|
cflags += [
|
gn format //build
A starting point for doing all of src, and adding a PRESUBMIT.
Includes https://codereview.chromium.org/772663002/ and https://codereview.chromium.org/770053002/.
I haven't pushed new binaries yet.
Generated via:
> cd build
> git ls-files *.gn *.gni | sed -e "s/^/@..\\\\out\\\\Debug\\\\gn format --in-place /" >x.bat && x.bat
The only things that I don't love in the current output are:
1. Turning
args = [
"--depfile", rebase_path(depfile, root_build_dir),
"--android-sdk-tools", rebased_android_sdk_build_tools,
"--dex-path", rebased_output,
]
into:
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--android-sdk-tools",
rebased_android_sdk_build_tools,
"--dex-path",
rebased_output,
]
The heuristic for this isn't trivial though, and it also affects e.g. '-Xclang' in cflags, as well
as assignments to temporaries that are later assigned to args.
2. Turning single line
if (defined(invoker.inputs)) { inputs = invoker.inputs }
into
if (defined(invoker.inputs)) {
inputs = invoker.inputs
}
This could be argued to be an improvement, but as it's very boilerplate-y perhaps an exception to
allow single line in this case is worthwhile. I think there was discussion of new syntax for this
case too, something like "inputs ?= invoker.inputs" maybe.
In both cases, I think it's worthwhile to get formatting turned on, and then go back and special
case these if we decide it's worthwhile.
R=brettw@chromium.org
BUG=348474
Review URL: https://codereview.chromium.org/766573003
Cr-Original-Commit-Position: refs/heads/master@{#306305}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b199254f481c5db36d56e83fce40594b06d2b81f
2014-12-02 03:25:20 +03:00
|
|
|
"-Xclang",
|
|
|
|
"-add-plugin",
|
|
|
|
"-Xclang",
|
|
|
|
"find-bad-constructs",
|
2017-03-03 03:31:51 +03:00
|
|
|
"-Xclang",
|
|
|
|
"-plugin-arg-find-bad-constructs",
|
|
|
|
"-Xclang",
|
|
|
|
"check-auto-raw-pointer",
|
2014-01-18 00:34:06 +04:00
|
|
|
]
|
Check IPC messages for banned types on Android.
This change enables check-ipc option for find-bad-constructs Clang
plugin on Android. With that option Clang plugin will check that the
following types are not used in IPC messages:
1. Types: long / unsigned long (but not typedefs to)
2. Typedefs: intmax_t, uintmax_t, intptr_t, uintptr_t, wint_t, size_t,
rsize_t, ssize_t, ptrdiff_t, dev_t, off_t, clock_t, time_t, suseconds_t
(including typedefs to)
3. Any template referencing the above (e.g. std::vector<size_t>)
These types are banned because they are not stable across 32/64-bit platforms.
BUG=581409
Review URL: https://codereview.chromium.org/1904553002
Cr-Original-Commit-Position: refs/heads/master@{#389850}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 972c22efaddb8a541351329c9e7609d04d75b95f
2016-04-26 22:34:17 +03:00
|
|
|
|
Check IPC messages for banned types on ChromeOS.
This change enables check-ipc option for find-bad-constructs Clang
plugin on ChromeOS (in addition to Linux and Android). With that
option Clang plugin will check that the following types are not used
in IPC messages:
1. Types: long / unsigned long (but not typedefs to)
2. Typedefs: intmax_t, uintmax_t, intptr_t, uintptr_t, wint_t, size_t,
rsize_t, ssize_t, ptrdiff_t, dev_t, off_t, clock_t, time_t, suseconds_t
(including typedefs to)
3. Any template referencing the above (e.g. std::vector<size_t>)
BUG=581409
Review-Url: https://codereview.chromium.org/1941033002
Cr-Original-Commit-Position: refs/heads/master@{#391328}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5bce05dfcc21c872c5ae4909ccb35780360dfc66
2016-05-03 22:35:24 +03:00
|
|
|
if ((is_linux || is_android) && !is_chromecast) {
|
Check IPC messages for banned types on Android.
This change enables check-ipc option for find-bad-constructs Clang
plugin on Android. With that option Clang plugin will check that the
following types are not used in IPC messages:
1. Types: long / unsigned long (but not typedefs to)
2. Typedefs: intmax_t, uintmax_t, intptr_t, uintptr_t, wint_t, size_t,
rsize_t, ssize_t, ptrdiff_t, dev_t, off_t, clock_t, time_t, suseconds_t
(including typedefs to)
3. Any template referencing the above (e.g. std::vector<size_t>)
These types are banned because they are not stable across 32/64-bit platforms.
BUG=581409
Review URL: https://codereview.chromium.org/1904553002
Cr-Original-Commit-Position: refs/heads/master@{#389850}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 972c22efaddb8a541351329c9e7609d04d75b95f
2016-04-26 22:34:17 +03:00
|
|
|
cflags += [
|
|
|
|
"-Xclang",
|
|
|
|
"-plugin-arg-find-bad-constructs",
|
|
|
|
"-Xclang",
|
|
|
|
"check-ipc",
|
|
|
|
]
|
|
|
|
}
|
2014-01-18 00:34:06 +04:00
|
|
|
}
|
2013-11-21 02:21:03 +04:00
|
|
|
}
|
2014-04-18 00:33:19 +04:00
|
|
|
|
|
|
|
# Enables some extra Clang-specific warnings. Some third-party code won't
|
|
|
|
# compile with these so may want to remove this config.
|
|
|
|
config("extra_warnings") {
|
|
|
|
cflags = [
|
2014-05-03 08:32:19 +04:00
|
|
|
"-Wheader-hygiene",
|
2014-04-18 00:33:19 +04:00
|
|
|
|
|
|
|
# Warns when a const char[] is converted to bool.
|
|
|
|
"-Wstring-conversion",
|
2016-12-17 21:51:05 +03:00
|
|
|
|
|
|
|
"-Wtautological-overlap-compare",
|
2014-04-18 00:33:19 +04:00
|
|
|
]
|
|
|
|
}
|