blob: 5f6630812440f1ce3bbb282b3ddbc3c9f11a7fb8 [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",
Andreas Gampe6142e582018-09-18 16:49:15 -070024 "modernize-redundant-void-arg",
Andreas Gampe8351aac2018-09-10 12:37:49 -070025 "modernize-use-bool-literals",
Andreas Gampe322c0892018-09-18 13:50:29 -070026 "modernize-use-nullptr",
27 "performance-faster-string-find",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070028 "performance-for-range-copy",
Andreas Gampe322c0892018-09-18 13:50:29 -070029 "performance-implicit-conversion-in-loop",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070030 "performance-unnecessary-copy-initialization",
31 "performance-unnecessary-value-param",
Andreas Gampebd39d142018-07-19 11:14:42 -070032 "misc-unused-using-decls",
Andreas Gampe896583e2018-06-15 13:31:58 -070033]
34// Should be: strings.Join(art_clang_tidy_errors, ",").
Andreas Gampe322c0892018-09-18 13:50:29 -070035art_clang_tidy_errors_str = "bugprone-lambda-function-name"
36 + ",bugprone-unused-raii"
37 + ",bugprone-virtual-near-miss"
Andreas Gampe6142e582018-09-18 16:49:15 -070038 + ",modernize-redundant-void-arg"
Andreas Gampe8351aac2018-09-10 12:37:49 -070039 + ",modernize-use-bool-literals"
Andreas Gampe322c0892018-09-18 13:50:29 -070040 + ",modernize-use-nullptr"
41 + ",performance-faster-string-find"
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070042 + ",performance-for-range-copy"
Andreas Gampe322c0892018-09-18 13:50:29 -070043 + ",performance-implicit-conversion-in-loop"
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070044 + ",performance-unnecessary-copy-initialization"
45 + ",performance-unnecessary-value-param"
Andreas Gampebd39d142018-07-19 11:14:42 -070046 + ",misc-unused-using-decls"
Andreas Gampe896583e2018-06-15 13:31:58 -070047
48art_clang_tidy_disabled = [
49 "-google-default-arguments",
50 // We have local stores that are only used for debug checks.
51 "-clang-analyzer-deadcode.DeadStores",
52 // We are OK with some static globals and that they can, in theory, throw.
53 "-cert-err58-cpp",
54 // We have lots of C-style variadic functions, and are OK with them. JNI ensures
55 // that working around this warning would be extra-painful.
56 "-cert-dcl50-cpp",
57 // No exceptions.
58 "-misc-noexcept-move-constructor",
59 "-performance-noexcept-move-constructor",
Andreas Gampe322c0892018-09-18 13:50:29 -070060 // "Modernization" we don't agree with.
61 "-modernize-use-auto",
62 "-modernize-return-braced-init-list",
63 "-modernize-use-default-member-init",
64 "-modernize-pass-by-value",
Andreas Gampe896583e2018-06-15 13:31:58 -070065]
66
Colin Cross1f7f3bd2016-07-27 10:12:38 -070067art_global_defaults {
68 // Additional flags are computed by art.go
69
70 name: "art_defaults",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070071 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -070072 // Base set of cflags used by all things ART.
73 "-fno-rtti",
74 "-ggdb3",
75 "-Wall",
76 "-Werror",
77 "-Wextra",
78 "-Wstrict-aliasing",
79 "-fstrict-aliasing",
80 "-Wunreachable-code",
81 "-Wredundant-decls",
82 "-Wshadow",
83 "-Wunused",
84 "-fvisibility=protected",
85
86 // Warn about thread safety violations with clang.
87 "-Wthread-safety",
88 "-Wthread-safety-negative",
89
90 // Warn if switch fallthroughs aren't annotated.
91 "-Wimplicit-fallthrough",
92
93 // Enable float equality warnings.
94 "-Wfloat-equal",
95
96 // Enable warning of converting ints to void*.
97 "-Wint-to-void-pointer-cast",
98
99 // Enable warning of wrong unused annotations.
100 "-Wused-but-marked-unused",
101
102 // Enable warning for deprecated language features.
103 "-Wdeprecated",
104
105 // Enable warning for unreachable break & return.
106 "-Wunreachable-code-break",
107 "-Wunreachable-code-return",
108
David Sehrae3bcac2017-02-03 15:19:00 -0800109 // Enable thread annotations for std::mutex, etc.
110 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700111 ],
112
113 target: {
114 android: {
115 cflags: [
116 "-DART_TARGET",
117
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700118 // To use oprofile_android --callgraph, uncomment this and recompile with
119 // mmma -j art
120 // "-fno-omit-frame-pointer",
121 // "-marm",
122 // "-mapcs",
123 ],
124 include_dirs: [
125 // We optimize Thread::Current() with a direct TLS access. This requires access to a
126 // private Bionic header.
127 "bionic/libc/private",
128 ],
129 },
Dan Willemsen057f1e42017-10-03 14:11:48 -0700130 linux: {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700131 cflags: [
132 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
133 // Apple, it's a pain.
134 "-Wmissing-noreturn",
135 ],
136 },
137 host: {
138 cflags: [
139 // Bug: 15446488. We don't omit the frame pointer to work around
140 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
141 "-fno-omit-frame-pointer",
Aart Bikf6052572017-07-20 16:47:45 -0700142 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
143 // desktops) support at least sse4.2/popcount. This firstly implies that the ART
144 // runtime binary itself may exploit these features. Secondly, this implies that
145 // the ART runtime passes these feature flags to dex2oat and JIT by calling the
146 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
147 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
148 // x86/x86_64 target should not be affected.
149 "-msse4.2",
150 "-mpopcnt",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700151 ],
152 },
153 },
154
155 codegen: {
156 arm: {
157 cflags: ["-DART_ENABLE_CODEGEN_arm"],
158 },
159 arm64: {
160 cflags: ["-DART_ENABLE_CODEGEN_arm64"],
161 },
162 mips: {
163 cflags: ["-DART_ENABLE_CODEGEN_mips"],
164 },
165 mips64: {
166 cflags: ["-DART_ENABLE_CODEGEN_mips64"],
167 },
168 x86: {
169 cflags: ["-DART_ENABLE_CODEGEN_x86"],
170 },
171 x86_64: {
172 cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
173 },
174 },
175
176 include_dirs: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700177 "external/vixl/src",
Andreas Gampe27bd4dd2017-08-23 11:27:08 -0700178 ],
Andreas Gampe61501212016-11-03 16:48:51 -0700179
Andreas Gampe896583e2018-06-15 13:31:58 -0700180 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled,
George Burgess IV7fb46652017-06-16 15:35:33 -0700181
182 tidy_flags: [
183 // The static analyzer treats DCHECK as always enabled; we sometimes get
184 // false positives when we use DCHECKs with code that relies on NDEBUG.
185 "-extra-arg=-UNDEBUG",
George Burgess IVdd8aa322017-06-21 16:34:35 -0700186 // clang-tidy complains about functions like:
187 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
188 // not being marked noreturn if kIsFooEnabled is false.
189 "-extra-arg=-Wno-missing-noreturn",
Andreas Gampe020020f2018-07-10 12:34:23 -0700190 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that
191 // the following code is dead (it is, but not for all configurations), disable unreachable
192 // code detection in Clang for tidy builds. It is still on for regular build steps, so we
193 // will still get the "real" errors.
194 "-extra-arg=-Wno-unreachable-code",
Andreas Gampe896583e2018-06-15 13:31:58 -0700195 // Use art_clang_tidy_errors for build errors.
196 "-warnings-as-errors=" + art_clang_tidy_errors_str,
George Burgess IV7fb46652017-06-16 15:35:33 -0700197 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700198}
199
Colin Crossbe332ed2016-09-21 13:23:53 -0700200art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700201 name: "art_debug_defaults",
202 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700203 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
204 "-DVIXL_DEBUG",
205 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700206 ],
207 asflags: [
208 "-UNDEBUG",
209 ],
Colin Crossc5644062016-08-30 15:41:08 -0700210 target: {
211 // This has to be duplicated for android and host to make sure it
212 // comes after the -Wframe-larger-than warnings inserted by art.go
213 // target-specific properties
214 android: {
215 cflags: ["-Wno-frame-larger-than="],
216 },
217 host: {
218 cflags: ["-Wno-frame-larger-than="],
219 },
220 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700221}