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", |
| 10 | "soong-cc", |
| 11 | ], |
| 12 | srcs: [ |
| 13 | "art.go", |
| 14 | "codegen.go", |
| 15 | "makevars.go", |
| 16 | ], |
| 17 | pluginFor: ["soong_build"], |
| 18 | } |
| 19 | |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 20 | art_clang_tidy_errors = [ |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 21 | "bugprone-lambda-function-name", |
| 22 | "bugprone-unused-raii", // Protect scoped things like MutexLock. |
| 23 | "bugprone-virtual-near-miss", |
Andreas Gampe | 6142e58 | 2018-09-18 16:49:15 -0700 | [diff] [blame^] | 24 | "modernize-redundant-void-arg", |
Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 25 | "modernize-use-bool-literals", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 26 | "modernize-use-nullptr", |
| 27 | "performance-faster-string-find", |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 28 | "performance-for-range-copy", |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 29 | "performance-implicit-conversion-in-loop", |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 30 | "performance-unnecessary-copy-initialization", |
| 31 | "performance-unnecessary-value-param", |
Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 32 | "misc-unused-using-decls", |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 33 | ] |
| 34 | // Should be: strings.Join(art_clang_tidy_errors, ","). |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 35 | art_clang_tidy_errors_str = "bugprone-lambda-function-name" |
| 36 | + ",bugprone-unused-raii" |
| 37 | + ",bugprone-virtual-near-miss" |
Andreas Gampe | 6142e58 | 2018-09-18 16:49:15 -0700 | [diff] [blame^] | 38 | + ",modernize-redundant-void-arg" |
Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 39 | + ",modernize-use-bool-literals" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 40 | + ",modernize-use-nullptr" |
| 41 | + ",performance-faster-string-find" |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 42 | + ",performance-for-range-copy" |
Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 43 | + ",performance-implicit-conversion-in-loop" |
Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 44 | + ",performance-unnecessary-copy-initialization" |
| 45 | + ",performance-unnecessary-value-param" |
Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 46 | + ",misc-unused-using-decls" |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 47 | |
| 48 | art_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 Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 60 | // "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 Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 65 | ] |
| 66 | |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 67 | art_global_defaults { |
| 68 | // Additional flags are computed by art.go |
| 69 | |
| 70 | name: "art_defaults", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 71 | cflags: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 72 | // 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 Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 109 | // Enable thread annotations for std::mutex, etc. |
| 110 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 111 | ], |
| 112 | |
| 113 | target: { |
| 114 | android: { |
| 115 | cflags: [ |
| 116 | "-DART_TARGET", |
| 117 | |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 118 | // 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 Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 130 | linux: { |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 131 | 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 Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 142 | // 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 151 | ], |
| 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 177 | "external/vixl/src", |
Andreas Gampe | 27bd4dd | 2017-08-23 11:27:08 -0700 | [diff] [blame] | 178 | ], |
Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 179 | |
Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 180 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 181 | |
| 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 IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 186 | // 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 Gampe | 020020f | 2018-07-10 12:34:23 -0700 | [diff] [blame] | 190 | // 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 Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 195 | // Use art_clang_tidy_errors for build errors. |
| 196 | "-warnings-as-errors=" + art_clang_tidy_errors_str, |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 197 | ], |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 198 | } |
| 199 | |
Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 200 | art_debug_defaults { |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 201 | name: "art_debug_defaults", |
| 202 | cflags: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 203 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 204 | "-DVIXL_DEBUG", |
| 205 | "-UNDEBUG", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 206 | ], |
| 207 | asflags: [ |
| 208 | "-UNDEBUG", |
| 209 | ], |
Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 210 | 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 221 | } |