Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 15 | package config |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 16 | |
| 17 | import ( |
Alex Naidis | 5df73d0 | 2017-04-05 20:08:41 +0200 | [diff] [blame] | 18 | "fmt" |
Stephen Crane | ba090d1 | 2017-05-09 15:44:35 -0700 | [diff] [blame] | 19 | "runtime" |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 20 | "strings" |
| 21 | |
| 22 | "android/soong/android" |
| 23 | ) |
| 24 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 25 | var ( |
Leo Li | e748f5d | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 26 | // Flags used by lots of devices. Putting them in package static variables |
| 27 | // will save bytes in build.ninja so they aren't repeated for every file |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 28 | commonGlobalCflags = []string{ |
| 29 | "-DANDROID", |
| 30 | "-fmessage-length=0", |
| 31 | "-W", |
| 32 | "-Wall", |
| 33 | "-Wno-unused", |
| 34 | "-Winit-self", |
| 35 | "-Wpointer-arith", |
| 36 | |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 37 | // Make paths in deps files relative |
| 38 | "-no-canonical-prefixes", |
Colin Cross | 39d450b | 2017-11-06 12:53:30 -0800 | [diff] [blame] | 39 | "-fno-canonical-system-headers", |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 40 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 41 | "-DNDEBUG", |
| 42 | "-UDEBUG", |
Colin Cross | 7278afc | 2017-11-02 22:38:32 -0700 | [diff] [blame] | 43 | |
| 44 | "-fno-exceptions", |
| 45 | "-Wno-multichar", |
| 46 | |
| 47 | "-O2", |
| 48 | "-g", |
| 49 | |
| 50 | "-fno-strict-aliasing", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 51 | } |
| 52 | |
Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 53 | commonGlobalConlyflags = []string{} |
Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 54 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 55 | deviceGlobalCflags = []string{ |
| 56 | "-fdiagnostics-color", |
| 57 | |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 58 | "-ffunction-sections", |
Colin Cross | ea3141d | 2017-11-06 14:02:02 -0800 | [diff] [blame] | 59 | "-fdata-sections", |
| 60 | "-fno-short-enums", |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 61 | "-funwind-tables", |
| 62 | "-fstack-protector-strong", |
| 63 | "-Wa,--noexecstack", |
| 64 | "-D_FORTIFY_SOURCE=2", |
| 65 | |
| 66 | "-Wstrict-aliasing=2", |
| 67 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 68 | "-Werror=return-type", |
| 69 | "-Werror=non-virtual-dtor", |
| 70 | "-Werror=address", |
| 71 | "-Werror=sequence-point", |
| 72 | "-Werror=date-time", |
Colin Cross | 133dbe7 | 2017-11-02 22:55:19 -0700 | [diff] [blame] | 73 | "-Werror=format-security", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 74 | } |
| 75 | |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 76 | deviceGlobalCppflags = []string{ |
| 77 | "-fvisibility-inlines-hidden", |
| 78 | } |
| 79 | |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 80 | deviceGlobalLdflags = []string{ |
| 81 | "-Wl,-z,noexecstack", |
| 82 | "-Wl,-z,relro", |
| 83 | "-Wl,-z,now", |
| 84 | "-Wl,--build-id=md5", |
| 85 | "-Wl,--warn-shared-textrel", |
| 86 | "-Wl,--fatal-warnings", |
| 87 | "-Wl,--no-undefined-version", |
| 88 | } |
| 89 | |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 90 | deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags), |
| 91 | []string{ |
| 92 | "-Wl,--pack-dyn-relocs=android", |
| 93 | "-fuse-ld=lld", |
| 94 | }...) |
| 95 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 96 | hostGlobalCflags = []string{} |
| 97 | |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 98 | hostGlobalCppflags = []string{} |
| 99 | |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 100 | hostGlobalLdflags = []string{} |
| 101 | |
Chih-Hung Hsieh | 3101a96 | 2018-04-17 14:16:05 -0700 | [diff] [blame^] | 102 | hostGlobalLldflags = []string{"-fuse-ld=lld"} |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 103 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 104 | commonGlobalCppflags = []string{ |
| 105 | "-Wsign-promo", |
| 106 | } |
| 107 | |
| 108 | noOverrideGlobalCflags = []string{ |
| 109 | "-Werror=int-to-pointer-cast", |
| 110 | "-Werror=pointer-to-int-cast", |
| 111 | } |
| 112 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 113 | IllegalFlags = []string{ |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 114 | "-w", |
| 115 | } |
Colin Cross | 6f6a428 | 2016-10-17 14:19:06 -0700 | [diff] [blame] | 116 | |
Dan Albert | 043833c | 2017-02-03 16:13:38 -0800 | [diff] [blame] | 117 | CStdVersion = "gnu99" |
| 118 | CppStdVersion = "gnu++14" |
| 119 | GccCppStdVersion = "gnu++11" |
| 120 | ExperimentalCStdVersion = "gnu11" |
| 121 | ExperimentalCppStdVersion = "gnu++1z" |
Jayant Chowdhary | 6e8115a | 2017-05-09 10:21:52 -0700 | [diff] [blame] | 122 | |
Dan Albert | c715eda | 2018-01-16 16:21:06 -0800 | [diff] [blame] | 123 | NdkMaxPrebuiltVersionInt = 27 |
Leo Li | e748f5d | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 124 | |
| 125 | // prebuilts/clang default settings. |
| 126 | ClangDefaultBase = "prebuilts/clang/host" |
Chih-Hung Hsieh | 3ede294 | 2018-01-10 14:30:44 -0800 | [diff] [blame] | 127 | ClangDefaultVersion = "clang-4679922" |
| 128 | ClangDefaultShortVersion = "7.0.1" |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 129 | |
Chih-Hung Hsieh | 775edde | 2017-12-24 22:24:47 -0800 | [diff] [blame] | 130 | // Directories with warnings from Android.bp files. |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 131 | WarningAllowedProjects = []string{ |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 132 | "device/", |
Chih-Hung Hsieh | 64a38dc | 2017-11-14 14:09:14 -0800 | [diff] [blame] | 133 | "vendor/", |
| 134 | } |
| 135 | |
Chih-Hung Hsieh | 775edde | 2017-12-24 22:24:47 -0800 | [diff] [blame] | 136 | // Directories with warnings from Android.mk files. |
| 137 | WarningAllowedOldProjects = []string{} |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 138 | ) |
| 139 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 140 | var pctx = android.NewPackageContext("android/soong/cc/config") |
| 141 | |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 142 | func init() { |
| 143 | if android.BuildOs == android.Linux { |
| 144 | commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=") |
| 145 | } |
| 146 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 147 | pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " ")) |
Elliott Hughes | 5a0401a | 2016-10-07 13:12:58 -0700 | [diff] [blame] | 148 | pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " ")) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 149 | pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " ")) |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 150 | pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " ")) |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 151 | pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " ")) |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 152 | pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " ")) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 153 | pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " ")) |
Colin Cross | 26f1450 | 2017-11-06 13:59:48 -0800 | [diff] [blame] | 154 | pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " ")) |
Colin Cross | 324a457 | 2017-11-02 23:09:41 -0700 | [diff] [blame] | 155 | pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " ")) |
Chih-Hung Hsieh | 02b4da5 | 2018-04-03 11:33:34 -0700 | [diff] [blame] | 156 | pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " ")) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 157 | pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 158 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 159 | pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 160 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 161 | pctx.StaticVariable("CommonClangGlobalCflags", |
| 162 | strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " ")) |
| 163 | pctx.StaticVariable("DeviceClangGlobalCflags", |
| 164 | strings.Join(append(ClangFilterUnknownCflags(deviceGlobalCflags), "${ClangExtraTargetCflags}"), " ")) |
| 165 | pctx.StaticVariable("HostClangGlobalCflags", |
| 166 | strings.Join(ClangFilterUnknownCflags(hostGlobalCflags), " ")) |
| 167 | pctx.StaticVariable("NoOverrideClangGlobalCflags", |
| 168 | strings.Join(append(ClangFilterUnknownCflags(noOverrideGlobalCflags), "${ClangExtraNoOverrideCflags}"), " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 169 | |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 170 | pctx.StaticVariable("CommonClangGlobalCppflags", |
| 171 | strings.Join(append(ClangFilterUnknownCflags(commonGlobalCppflags), "${ClangExtraCppflags}"), " ")) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 172 | |
Colin Cross | 1cfd89a | 2016-09-15 09:30:46 -0700 | [diff] [blame] | 173 | // Everything in these lists is a crime against abstraction and dependency tracking. |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 174 | // Do not add anything to this list. |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 175 | pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", |
Colin Cross | e4bba1e | 2016-09-22 15:29:50 -0700 | [diff] [blame] | 176 | []string{ |
Colin Cross | 763a26c | 2016-09-23 15:48:51 +0000 | [diff] [blame] | 177 | "system/core/include", |
Colin Cross | 1928093 | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 178 | "system/media/audio/include", |
Colin Cross | 2d44c2c | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 179 | "hardware/libhardware/include", |
Colin Cross | 328f04e | 2016-11-03 15:45:34 -0700 | [diff] [blame] | 180 | "hardware/libhardware_legacy/include", |
| 181 | "hardware/ril/include", |
| 182 | "libnativehelper/include", |
Colin Cross | 315a6ff | 2016-10-05 12:36:42 -0700 | [diff] [blame] | 183 | "frameworks/native/include", |
Colin Cross | 14e8dd7 | 2016-12-14 11:13:16 -0800 | [diff] [blame] | 184 | "frameworks/native/opengl/include", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 185 | "frameworks/av/include", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 186 | }) |
| 187 | // This is used by non-NDK modules to get jni.h. export_include_dirs doesn't help |
| 188 | // with this, since there is no associated library. |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 189 | pctx.PrefixedExistentPathsForSourcesVariable("CommonNativehelperInclude", "-I", |
Steven Moreland | 3cf6306 | 2017-07-18 13:29:35 -0700 | [diff] [blame] | 190 | []string{"libnativehelper/include_deprecated"}) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 191 | |
Leo Li | e748f5d | 2017-05-22 16:11:34 -0700 | [diff] [blame] | 192 | pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase) |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 193 | pctx.VariableFunc("ClangBase", func(ctx android.PackageVarContext) string { |
| 194 | if override := ctx.Config().Getenv("LLVM_PREBUILTS_BASE"); override != "" { |
| 195 | return override |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 196 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 197 | return "${ClangDefaultBase}" |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 198 | }) |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 199 | pctx.VariableFunc("ClangVersion", func(ctx android.PackageVarContext) string { |
| 200 | if override := ctx.Config().Getenv("LLVM_PREBUILTS_VERSION"); override != "" { |
| 201 | return override |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 202 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 203 | return ClangDefaultVersion |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 204 | }) |
Colin Cross | b98c8b0 | 2016-07-29 13:44:28 -0700 | [diff] [blame] | 205 | pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}") |
| 206 | pctx.StaticVariable("ClangBin", "${ClangPath}/bin") |
| 207 | |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 208 | pctx.VariableFunc("ClangShortVersion", func(ctx android.PackageVarContext) string { |
| 209 | if override := ctx.Config().Getenv("LLVM_RELEASE_VERSION"); override != "" { |
| 210 | return override |
Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 211 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 212 | return ClangDefaultShortVersion |
Stephen Hines | e55a4cc | 2016-11-18 17:12:38 -0800 | [diff] [blame] | 213 | }) |
Stephen Hines | 755fe07 | 2018-01-24 19:58:36 -0800 | [diff] [blame] | 214 | pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib64/clang/${ClangShortVersion}/lib/linux") |
Stephen Crane | ba090d1 | 2017-05-09 15:44:35 -0700 | [diff] [blame] | 215 | if runtime.GOOS == "darwin" { |
| 216 | pctx.StaticVariable("LLVMGoldPlugin", "${ClangPath}/lib64/LLVMgold.dylib") |
| 217 | } else { |
| 218 | pctx.StaticVariable("LLVMGoldPlugin", "${ClangPath}/lib64/LLVMgold.so") |
| 219 | } |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 220 | |
Jayant Chowdhary | e622d20 | 2017-02-01 19:19:52 -0800 | [diff] [blame] | 221 | // These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts |
| 222 | // being used for the rest of the build process. |
| 223 | pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host") |
| 224 | pctx.SourcePathVariable("RSClangVersion", "clang-3289846") |
| 225 | pctx.SourcePathVariable("RSReleaseVersion", "3.8") |
| 226 | pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin") |
| 227 | pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include") |
| 228 | |
Jeff Gaston | 734e380 | 2017-04-10 15:47:24 -0700 | [diff] [blame] | 229 | pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I", |
Colin Cross | 2a252be | 2017-05-01 17:37:24 -0700 | [diff] [blame] | 230 | []string{ |
| 231 | "external/clang/lib/Headers", |
| 232 | "frameworks/rs/script_api/include", |
| 233 | }) |
| 234 | |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 235 | pctx.VariableFunc("CcWrapper", func(ctx android.PackageVarContext) string { |
| 236 | if override := ctx.Config().Getenv("CC_WRAPPER"); override != "" { |
| 237 | return override + " " |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 238 | } |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 239 | return "" |
Alistair Strachan | 777475c | 2016-08-26 12:55:49 -0700 | [diff] [blame] | 240 | }) |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS) |
| 244 | |
Elliott Hughes | de28deb | 2017-10-12 09:07:53 -0700 | [diff] [blame] | 245 | func bionicHeaders(kernelArch string) string { |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 246 | return strings.Join([]string{ |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 247 | "-isystem bionic/libc/include", |
| 248 | "-isystem bionic/libc/kernel/uapi", |
| 249 | "-isystem bionic/libc/kernel/uapi/asm-" + kernelArch, |
Elliott Hughes | 98418a0 | 2017-05-25 17:16:10 -0700 | [diff] [blame] | 250 | "-isystem bionic/libc/kernel/android/scsi", |
Colin Cross | 4d9c2d1 | 2016-07-29 12:48:20 -0700 | [diff] [blame] | 251 | "-isystem bionic/libc/kernel/android/uapi", |
| 252 | }, " ") |
| 253 | } |
Dan Willemsen | d2ede87 | 2016-11-18 14:54:24 -0800 | [diff] [blame] | 254 | |
Alex Naidis | 5df73d0 | 2017-04-05 20:08:41 +0200 | [diff] [blame] | 255 | func replaceFirst(slice []string, from, to string) { |
| 256 | if slice[0] != from { |
| 257 | panic(fmt.Errorf("Expected %q, found %q", from, to)) |
| 258 | } |
| 259 | slice[0] = to |
| 260 | } |