| 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", |
| 24 | "modernize-use-nullptr", |
| 25 | "performance-faster-string-find", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 26 | "performance-for-range-copy", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame^] | 27 | "performance-implicit-conversion-in-loop", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 28 | "performance-unnecessary-copy-initialization", |
| 29 | "performance-unnecessary-value-param", |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 30 | "misc-unused-using-decls", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 31 | ] |
| 32 | // Should be: strings.Join(art_clang_tidy_errors, ","). |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame^] | 33 | art_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 Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 38 | + ",performance-for-range-copy" |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame^] | 39 | + ",performance-implicit-conversion-in-loop" |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 40 | + ",performance-unnecessary-copy-initialization" |
| 41 | + ",performance-unnecessary-value-param" |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 42 | + ",misc-unused-using-decls" |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 43 | |
| 44 | art_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 Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame^] | 56 | // "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 Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 61 | ] |
| 62 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 63 | art_global_defaults { |
| 64 | // Additional flags are computed by art.go |
| 65 | |
| 66 | name: "art_defaults", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 67 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 68 | // 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 Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 105 | // Enable thread annotations for std::mutex, etc. |
| 106 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 107 | ], |
| 108 | |
| 109 | target: { |
| 110 | android: { |
| 111 | cflags: [ |
| 112 | "-DART_TARGET", |
| 113 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 114 | // 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 Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 126 | linux: { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 127 | 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 Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 138 | // 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 147 | ], |
| 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 173 | "external/vixl/src", |
| Andreas Gampe | 27bd4dd | 2017-08-23 11:27:08 -0700 | [diff] [blame] | 174 | ], |
| Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 175 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 176 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 177 | |
| 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 IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 182 | // 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 Gampe | 020020f | 2018-07-10 12:34:23 -0700 | [diff] [blame] | 186 | // 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 Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 191 | // Use art_clang_tidy_errors for build errors. |
| 192 | "-warnings-as-errors=" + art_clang_tidy_errors_str, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 193 | ], |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 194 | } |
| 195 | |
| Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 196 | art_debug_defaults { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 197 | name: "art_debug_defaults", |
| 198 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 199 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 200 | "-DVIXL_DEBUG", |
| 201 | "-UNDEBUG", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 202 | ], |
| 203 | asflags: [ |
| 204 | "-UNDEBUG", |
| 205 | ], |
| Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 206 | 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 Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 217 | } |