Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 1 | bootstrap_go_package { |
| 2 | name: "soong-art", |
| 3 | pkgPath: "android/soong/art", |
| 4 | deps: [ |
| 5 | "blueprint", |
| 6 | "blueprint-pathtools", |
Colin Cross | 84b6933 | 2017-11-01 14:23:17 -0700 | [diff] [blame] | 7 | "blueprint-proptools", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 8 | "soong", |
| 9 | "soong-android", |
Alex Light | da948ce | 2018-12-06 17:05:41 +0000 | [diff] [blame] | 10 | "soong-apex", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 11 | "soong-cc", |
| 12 | ], |
| 13 | srcs: [ |
| 14 | "art.go", |
| 15 | "codegen.go", |
| 16 | "makevars.go", |
| 17 | ], |
| 18 | pluginFor: ["soong_build"], |
| 19 | } |
| 20 | |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 21 | art_clang_tidy_errors = [ |
Andreas Gampe | dfcd82c | 2018-10-16 20:22:37 -0700 | [diff] [blame] | 22 | "android-cloexec-dup", |
| 23 | "android-cloexec-open", |
Andreas Gampe | 6cd8390 | 2018-10-03 20:03:03 -0700 | [diff] [blame] | 24 | "bugprone-argument-comment", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 25 | "bugprone-lambda-function-name", |
| 26 | "bugprone-unused-raii", // Protect scoped things like MutexLock. |
Andreas Gampe | afaf7f8 | 2018-10-16 11:32:38 -0700 | [diff] [blame] | 27 | "bugprone-unused-return-value", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 28 | "bugprone-virtual-near-miss", |
Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 29 | "modernize-use-bool-literals", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 30 | "modernize-use-nullptr", |
Andreas Gampe | c55bb39 | 2018-09-21 00:02:02 +0000 | [diff] [blame] | 31 | "modernize-use-using", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 32 | "performance-faster-string-find", |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 33 | "performance-for-range-copy", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 34 | "performance-implicit-conversion-in-loop", |
Andreas Gampe | 44b3174 | 2018-10-01 19:30:57 -0700 | [diff] [blame] | 35 | "performance-noexcept-move-constructor", |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 36 | "performance-unnecessary-copy-initialization", |
| 37 | "performance-unnecessary-value-param", |
Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 38 | "misc-unused-using-decls", |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 39 | ] |
| 40 | // Should be: strings.Join(art_clang_tidy_errors, ","). |
Andreas Gampe | dfcd82c | 2018-10-16 20:22:37 -0700 | [diff] [blame] | 41 | art_clang_tidy_errors_str = "android-cloexec-dup" |
| 42 | + ",android-cloexec-open" |
| 43 | + ",bugprone-argument-comment" |
Andreas Gampe | 6cd8390 | 2018-10-03 20:03:03 -0700 | [diff] [blame] | 44 | + ",bugprone-lambda-function-name" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 45 | + ",bugprone-unused-raii" |
Andreas Gampe | afaf7f8 | 2018-10-16 11:32:38 -0700 | [diff] [blame] | 46 | + ",bugprone-unused-return-value" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 47 | + ",bugprone-virtual-near-miss" |
Andreas Gampe | 6142e58 | 2018-09-18 16:49:15 -0700 | [diff] [blame] | 48 | + ",modernize-redundant-void-arg" |
Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 49 | + ",modernize-use-bool-literals" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 50 | + ",modernize-use-nullptr" |
Andreas Gampe | c55bb39 | 2018-09-21 00:02:02 +0000 | [diff] [blame] | 51 | + ",modernize-use-using" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 52 | + ",performance-faster-string-find" |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 53 | + ",performance-for-range-copy" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 54 | + ",performance-implicit-conversion-in-loop" |
Andreas Gampe | 44b3174 | 2018-10-01 19:30:57 -0700 | [diff] [blame] | 55 | + ",performance-noexcept-move-constructor" |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 56 | + ",performance-unnecessary-copy-initialization" |
| 57 | + ",performance-unnecessary-value-param" |
Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 58 | + ",misc-unused-using-decls" |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 59 | |
| 60 | art_clang_tidy_disabled = [ |
| 61 | "-google-default-arguments", |
| 62 | // We have local stores that are only used for debug checks. |
| 63 | "-clang-analyzer-deadcode.DeadStores", |
| 64 | // We are OK with some static globals and that they can, in theory, throw. |
| 65 | "-cert-err58-cpp", |
| 66 | // We have lots of C-style variadic functions, and are OK with them. JNI ensures |
| 67 | // that working around this warning would be extra-painful. |
| 68 | "-cert-dcl50-cpp", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 69 | // "Modernization" we don't agree with. |
| 70 | "-modernize-use-auto", |
| 71 | "-modernize-return-braced-init-list", |
| 72 | "-modernize-use-default-member-init", |
| 73 | "-modernize-pass-by-value", |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 74 | ] |
| 75 | |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 76 | art_global_defaults { |
| 77 | // Additional flags are computed by art.go |
| 78 | |
| 79 | name: "art_defaults", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 80 | cflags: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 81 | // Base set of cflags used by all things ART. |
| 82 | "-fno-rtti", |
| 83 | "-ggdb3", |
| 84 | "-Wall", |
| 85 | "-Werror", |
| 86 | "-Wextra", |
| 87 | "-Wstrict-aliasing", |
| 88 | "-fstrict-aliasing", |
| 89 | "-Wunreachable-code", |
| 90 | "-Wredundant-decls", |
| 91 | "-Wshadow", |
| 92 | "-Wunused", |
| 93 | "-fvisibility=protected", |
| 94 | |
| 95 | // Warn about thread safety violations with clang. |
| 96 | "-Wthread-safety", |
| 97 | "-Wthread-safety-negative", |
| 98 | |
| 99 | // Warn if switch fallthroughs aren't annotated. |
| 100 | "-Wimplicit-fallthrough", |
| 101 | |
| 102 | // Enable float equality warnings. |
| 103 | "-Wfloat-equal", |
| 104 | |
| 105 | // Enable warning of converting ints to void*. |
| 106 | "-Wint-to-void-pointer-cast", |
| 107 | |
| 108 | // Enable warning of wrong unused annotations. |
| 109 | "-Wused-but-marked-unused", |
| 110 | |
| 111 | // Enable warning for deprecated language features. |
| 112 | "-Wdeprecated", |
| 113 | |
| 114 | // Enable warning for unreachable break & return. |
| 115 | "-Wunreachable-code-break", |
| 116 | "-Wunreachable-code-return", |
| 117 | |
David Srbecky | 56de89a | 2018-10-01 15:32:20 +0100 | [diff] [blame] | 118 | // Disable warning for use of offsetof on non-standard layout type. |
| 119 | // We use it to implement OFFSETOF_MEMBER - see macros.h. |
| 120 | "-Wno-invalid-offsetof", |
| 121 | |
David Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 122 | // Enable thread annotations for std::mutex, etc. |
| 123 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 124 | ], |
| 125 | |
| 126 | target: { |
| 127 | android: { |
| 128 | cflags: [ |
| 129 | "-DART_TARGET", |
| 130 | |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 131 | // To use oprofile_android --callgraph, uncomment this and recompile with |
| 132 | // mmma -j art |
| 133 | // "-fno-omit-frame-pointer", |
| 134 | // "-marm", |
| 135 | // "-mapcs", |
| 136 | ], |
| 137 | include_dirs: [ |
| 138 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| 139 | // private Bionic header. |
| 140 | "bionic/libc/private", |
| 141 | ], |
| 142 | }, |
Dan Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 143 | linux: { |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 144 | cflags: [ |
| 145 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for |
| 146 | // Apple, it's a pain. |
| 147 | "-Wmissing-noreturn", |
| 148 | ], |
| 149 | }, |
| 150 | host: { |
| 151 | cflags: [ |
| 152 | // Bug: 15446488. We don't omit the frame pointer to work around |
| 153 | // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 154 | "-fno-omit-frame-pointer", |
Aart Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 155 | // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer |
| 156 | // desktops) support at least sse4.2/popcount. This firstly implies that the ART |
| 157 | // runtime binary itself may exploit these features. Secondly, this implies that |
| 158 | // the ART runtime passes these feature flags to dex2oat and JIT by calling the |
| 159 | // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly |
| 160 | // does not pick up these flags, cross-compiling from a x86/x86_64 host to a |
| 161 | // x86/x86_64 target should not be affected. |
| 162 | "-msse4.2", |
| 163 | "-mpopcnt", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 164 | ], |
| 165 | }, |
| 166 | }, |
| 167 | |
| 168 | codegen: { |
| 169 | arm: { |
| 170 | cflags: ["-DART_ENABLE_CODEGEN_arm"], |
| 171 | }, |
| 172 | arm64: { |
| 173 | cflags: ["-DART_ENABLE_CODEGEN_arm64"], |
| 174 | }, |
| 175 | mips: { |
| 176 | cflags: ["-DART_ENABLE_CODEGEN_mips"], |
| 177 | }, |
| 178 | mips64: { |
| 179 | cflags: ["-DART_ENABLE_CODEGEN_mips64"], |
| 180 | }, |
| 181 | x86: { |
| 182 | cflags: ["-DART_ENABLE_CODEGEN_x86"], |
| 183 | }, |
| 184 | x86_64: { |
| 185 | cflags: ["-DART_ENABLE_CODEGEN_x86_64"], |
| 186 | }, |
| 187 | }, |
| 188 | |
| 189 | include_dirs: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 190 | "external/vixl/src", |
Andreas Gampe | 27bd4dd | 2017-08-23 11:27:08 -0700 | [diff] [blame] | 191 | ], |
Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 192 | |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 193 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 194 | |
| 195 | tidy_flags: [ |
| 196 | // The static analyzer treats DCHECK as always enabled; we sometimes get |
| 197 | // false positives when we use DCHECKs with code that relies on NDEBUG. |
| 198 | "-extra-arg=-UNDEBUG", |
George Burgess IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 199 | // clang-tidy complains about functions like: |
| 200 | // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } |
| 201 | // not being marked noreturn if kIsFooEnabled is false. |
| 202 | "-extra-arg=-Wno-missing-noreturn", |
Andreas Gampe | 020020f | 2018-07-10 12:34:23 -0700 | [diff] [blame] | 203 | // Because tidy doesn't like our flow checks for compile-time configuration and thinks that |
| 204 | // the following code is dead (it is, but not for all configurations), disable unreachable |
| 205 | // code detection in Clang for tidy builds. It is still on for regular build steps, so we |
| 206 | // will still get the "real" errors. |
| 207 | "-extra-arg=-Wno-unreachable-code", |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 208 | // Use art_clang_tidy_errors for build errors. |
| 209 | "-warnings-as-errors=" + art_clang_tidy_errors_str, |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 210 | ], |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 211 | } |
| 212 | |
Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 213 | art_debug_defaults { |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 214 | name: "art_debug_defaults", |
| 215 | cflags: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 216 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 217 | "-DVIXL_DEBUG", |
| 218 | "-UNDEBUG", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 219 | ], |
| 220 | asflags: [ |
| 221 | "-UNDEBUG", |
| 222 | ], |
Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 223 | target: { |
| 224 | // This has to be duplicated for android and host to make sure it |
| 225 | // comes after the -Wframe-larger-than warnings inserted by art.go |
| 226 | // target-specific properties |
| 227 | android: { |
| 228 | cflags: ["-Wno-frame-larger-than="], |
| 229 | }, |
| 230 | host: { |
| 231 | cflags: ["-Wno-frame-larger-than="], |
| 232 | }, |
| 233 | }, |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 234 | } |