blob: 85577984d6cf6e7a74c98952f827258450321553 [file] [log] [blame]
Colin Cross1f7f3bd2016-07-27 10:12:38 -07001bootstrap_go_package {
2 name: "soong-art",
3 pkgPath: "android/soong/art",
4 deps: [
5 "blueprint",
6 "blueprint-pathtools",
Colin Cross84b69332017-11-01 14:23:17 -07007 "blueprint-proptools",
Colin Cross1f7f3bd2016-07-27 10:12:38 -07008 "soong",
9 "soong-android",
10 "soong-cc",
11 ],
12 srcs: [
13 "art.go",
14 "codegen.go",
15 "makevars.go",
16 ],
17 pluginFor: ["soong_build"],
18}
19
Andreas Gampe896583e2018-06-15 13:31:58 -070020art_clang_tidy_errors = [
Andreas Gampe322c0892018-09-18 13:50:29 -070021 "bugprone-lambda-function-name",
22 "bugprone-unused-raii", // Protect scoped things like MutexLock.
23 "bugprone-virtual-near-miss",
24 "modernize-use-nullptr",
25 "performance-faster-string-find",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070026 "performance-for-range-copy",
Andreas Gampe322c0892018-09-18 13:50:29 -070027 "performance-implicit-conversion-in-loop",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070028 "performance-unnecessary-copy-initialization",
29 "performance-unnecessary-value-param",
Andreas Gampebd39d142018-07-19 11:14:42 -070030 "misc-unused-using-decls",
Andreas Gampe896583e2018-06-15 13:31:58 -070031]
32// Should be: strings.Join(art_clang_tidy_errors, ",").
Andreas Gampe322c0892018-09-18 13:50:29 -070033art_clang_tidy_errors_str = "bugprone-lambda-function-name"
34 + ",bugprone-unused-raii"
35 + ",bugprone-virtual-near-miss"
36 + ",modernize-use-nullptr"
37 + ",performance-faster-string-find"
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070038 + ",performance-for-range-copy"
Andreas Gampe322c0892018-09-18 13:50:29 -070039 + ",performance-implicit-conversion-in-loop"
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070040 + ",performance-unnecessary-copy-initialization"
41 + ",performance-unnecessary-value-param"
Andreas Gampebd39d142018-07-19 11:14:42 -070042 + ",misc-unused-using-decls"
Andreas Gampe896583e2018-06-15 13:31:58 -070043
44art_clang_tidy_disabled = [
45 "-google-default-arguments",
46 // We have local stores that are only used for debug checks.
47 "-clang-analyzer-deadcode.DeadStores",
48 // We are OK with some static globals and that they can, in theory, throw.
49 "-cert-err58-cpp",
50 // We have lots of C-style variadic functions, and are OK with them. JNI ensures
51 // that working around this warning would be extra-painful.
52 "-cert-dcl50-cpp",
53 // No exceptions.
54 "-misc-noexcept-move-constructor",
55 "-performance-noexcept-move-constructor",
Andreas Gampe322c0892018-09-18 13:50:29 -070056 // "Modernization" we don't agree with.
57 "-modernize-use-auto",
58 "-modernize-return-braced-init-list",
59 "-modernize-use-default-member-init",
60 "-modernize-pass-by-value",
Andreas Gampe896583e2018-06-15 13:31:58 -070061]
62
Colin Cross1f7f3bd2016-07-27 10:12:38 -070063art_global_defaults {
64 // Additional flags are computed by art.go
65
66 name: "art_defaults",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070067 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -070068 // Base set of cflags used by all things ART.
69 "-fno-rtti",
70 "-ggdb3",
71 "-Wall",
72 "-Werror",
73 "-Wextra",
74 "-Wstrict-aliasing",
75 "-fstrict-aliasing",
76 "-Wunreachable-code",
77 "-Wredundant-decls",
78 "-Wshadow",
79 "-Wunused",
80 "-fvisibility=protected",
81
82 // Warn about thread safety violations with clang.
83 "-Wthread-safety",
84 "-Wthread-safety-negative",
85
86 // Warn if switch fallthroughs aren't annotated.
87 "-Wimplicit-fallthrough",
88
89 // Enable float equality warnings.
90 "-Wfloat-equal",
91
92 // Enable warning of converting ints to void*.
93 "-Wint-to-void-pointer-cast",
94
95 // Enable warning of wrong unused annotations.
96 "-Wused-but-marked-unused",
97
98 // Enable warning for deprecated language features.
99 "-Wdeprecated",
100
101 // Enable warning for unreachable break & return.
102 "-Wunreachable-code-break",
103 "-Wunreachable-code-return",
104
David Sehrae3bcac2017-02-03 15:19:00 -0800105 // Enable thread annotations for std::mutex, etc.
106 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700107 ],
108
109 target: {
110 android: {
111 cflags: [
112 "-DART_TARGET",
113
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700114 // To use oprofile_android --callgraph, uncomment this and recompile with
115 // mmma -j art
116 // "-fno-omit-frame-pointer",
117 // "-marm",
118 // "-mapcs",
119 ],
120 include_dirs: [
121 // We optimize Thread::Current() with a direct TLS access. This requires access to a
122 // private Bionic header.
123 "bionic/libc/private",
124 ],
125 },
Dan Willemsen057f1e42017-10-03 14:11:48 -0700126 linux: {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700127 cflags: [
128 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
129 // Apple, it's a pain.
130 "-Wmissing-noreturn",
131 ],
132 },
133 host: {
134 cflags: [
135 // Bug: 15446488. We don't omit the frame pointer to work around
136 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
137 "-fno-omit-frame-pointer",
Aart Bikf6052572017-07-20 16:47:45 -0700138 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
139 // desktops) support at least sse4.2/popcount. This firstly implies that the ART
140 // runtime binary itself may exploit these features. Secondly, this implies that
141 // the ART runtime passes these feature flags to dex2oat and JIT by calling the
142 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
143 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
144 // x86/x86_64 target should not be affected.
145 "-msse4.2",
146 "-mpopcnt",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700147 ],
148 },
149 },
150
151 codegen: {
152 arm: {
153 cflags: ["-DART_ENABLE_CODEGEN_arm"],
154 },
155 arm64: {
156 cflags: ["-DART_ENABLE_CODEGEN_arm64"],
157 },
158 mips: {
159 cflags: ["-DART_ENABLE_CODEGEN_mips"],
160 },
161 mips64: {
162 cflags: ["-DART_ENABLE_CODEGEN_mips64"],
163 },
164 x86: {
165 cflags: ["-DART_ENABLE_CODEGEN_x86"],
166 },
167 x86_64: {
168 cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
169 },
170 },
171
172 include_dirs: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700173 "external/vixl/src",
Andreas Gampe27bd4dd2017-08-23 11:27:08 -0700174 ],
Andreas Gampe61501212016-11-03 16:48:51 -0700175
Andreas Gampe896583e2018-06-15 13:31:58 -0700176 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled,
George Burgess IV7fb46652017-06-16 15:35:33 -0700177
178 tidy_flags: [
179 // The static analyzer treats DCHECK as always enabled; we sometimes get
180 // false positives when we use DCHECKs with code that relies on NDEBUG.
181 "-extra-arg=-UNDEBUG",
George Burgess IVdd8aa322017-06-21 16:34:35 -0700182 // clang-tidy complains about functions like:
183 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
184 // not being marked noreturn if kIsFooEnabled is false.
185 "-extra-arg=-Wno-missing-noreturn",
Andreas Gampe020020f2018-07-10 12:34:23 -0700186 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that
187 // the following code is dead (it is, but not for all configurations), disable unreachable
188 // code detection in Clang for tidy builds. It is still on for regular build steps, so we
189 // will still get the "real" errors.
190 "-extra-arg=-Wno-unreachable-code",
Andreas Gampe896583e2018-06-15 13:31:58 -0700191 // Use art_clang_tidy_errors for build errors.
192 "-warnings-as-errors=" + art_clang_tidy_errors_str,
George Burgess IV7fb46652017-06-16 15:35:33 -0700193 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700194}
195
Colin Crossbe332ed2016-09-21 13:23:53 -0700196art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700197 name: "art_debug_defaults",
198 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700199 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
200 "-DVIXL_DEBUG",
201 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700202 ],
203 asflags: [
204 "-UNDEBUG",
205 ],
Colin Crossc5644062016-08-30 15:41:08 -0700206 target: {
207 // This has to be duplicated for android and host to make sure it
208 // comes after the -Wframe-larger-than warnings inserted by art.go
209 // target-specific properties
210 android: {
211 cflags: ["-Wno-frame-larger-than="],
212 },
213 host: {
214 cflags: ["-Wno-frame-larger-than="],
215 },
216 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700217}