OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 import("//build/config/android/config.gni") |
5 import("//build/config/linux/sysroot.gni") | 6 import("//build/config/linux/sysroot.gni") |
6 | 7 |
| 8 # compiler --------------------------------------------------------------------- |
| 9 # |
7 # Base compiler configuration. | 10 # Base compiler configuration. |
| 11 # |
| 12 # See also "runtime_library" below for related stuff and a discusison about |
| 13 # where stuff should go. Put warning related stuff in the "warnings" config. |
| 14 |
8 config("compiler") { | 15 config("compiler") { |
9 include_dirs = [ "//", root_gen_dir ] | 16 cflags = [] |
| 17 cflags_c = [] |
| 18 cflags_cc = [] |
| 19 ldflags = [] |
| 20 defines = [] |
| 21 include_dirs = [] |
| 22 |
| 23 include_dirs += [ "//", root_gen_dir ] |
| 24 |
| 25 # In general, Windows is totally different, but all the other builds share |
| 26 # some common GCC configuration. This section sets up Windows and the common |
| 27 # GCC flags, and then we handle the other non-Windows platforms specifically |
| 28 # below. |
10 if (is_win) { | 29 if (is_win) { |
11 cflags = [ | 30 # Windows compiler flags setup. |
| 31 # ----------------------------- |
| 32 cflags += [ |
12 "/Gy", # Enable function-level linking. | 33 "/Gy", # Enable function-level linking. |
13 "/GS", # Enable buffer security checking. | 34 "/GS", # Enable buffer security checking. |
14 "/EHsc", # Assume C functions can't throw exceptions and don't catch | 35 "/EHsc", # Assume C functions can't throw exceptions and don't catch |
15 # structured exceptions (only C++ ones). | 36 # structured exceptions (only C++ ones). |
16 ] | 37 ] |
17 } else { | 38 } else { |
18 # Common GCC compiler flags setup. | 39 # Common GCC compiler flags setup. |
19 # -------------------------------- | 40 # -------------------------------- |
20 cflags = [ | 41 cflags += [ |
21 "-fno-strict-aliasing", # See http://crbug.com/32204 | 42 "-fno-strict-aliasing", # See http://crbug.com/32204 |
22 "-fvisibility=hidden", | 43 "-fvisibility=hidden", |
23 ] | 44 ] |
24 cflags_c = [ | 45 cflags_cc += [ |
25 ] | |
26 cflags_cc = [ | |
27 "-fno-exceptions", | 46 "-fno-exceptions", |
28 "-fno-threadsafe-statics", | 47 "-fno-threadsafe-statics", |
29 "-fvisibility-inlines-hidden", | 48 "-fvisibility-inlines-hidden", |
30 ] | 49 ] |
31 ldflags = [ | |
32 ] | |
33 | 50 |
34 # Stack protection. | 51 # Stack protection. |
35 if (is_mac) { | 52 if (is_mac) { |
36 cflags += "-fstack-protector-all" | 53 cflags += "-fstack-protector-all" |
37 } else if (is_linux) { | 54 } else if (is_linux) { |
38 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] | 55 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] |
39 } | 56 } |
| 57 } |
40 | 58 |
41 if (is_mac) { | 59 # Mac-specific compiler flags setup. |
42 # Mac-specific compiler flags setup. | 60 # ---------------------------------- |
43 # ---------------------------------- | 61 if (is_mac) { |
| 62 # These flags are shared between the C compiler and linker. |
| 63 common_mac_flags = [ |
| 64 "-isysroot", sysroot, |
| 65 "-mmacosx-version-min=10.6", |
| 66 ] |
44 | 67 |
45 # These flags are shared between the C compiler and linker. | 68 # CPU architecture. |
46 common_mac_flags = [ | 69 if (cpu_arch == "x64") { |
47 "-isysroot", sysroot, | 70 common_mac_flags += "-arch x86_64" |
48 "-mmacosx-version-min=10.6", | 71 } else if (cpu_arch == "x86") { |
49 ] | 72 common_mac_flags += "-arch i386" |
50 | |
51 # CPU architecture. | |
52 if (cpu_arch == "x64") { | |
53 common_mac_flags += "-arch x86_64" | |
54 } else if (cpu_arch == "x86") { | |
55 common_mac_flags += "-arch i386" | |
56 } | |
57 | |
58 cflags += common_mac_flags + [ | |
59 # Without this, the constructors and destructors of a C++ object inside | |
60 # an Objective C struct won't be called, which is very bad. | |
61 "-fobjc-call-cxx-cdtors", | |
62 ] | |
63 | |
64 cflags_c += [ "-std=c99" ] | |
65 cflags_cc += [ "-std=gnu++11" ] | |
66 | |
67 ldflags += common_mac_flags + [ | |
68 "-L.", | |
69 | |
70 # TODO(brettW) I don't understand these options. | |
71 "-Wl,-rpath,@loader_path/.", | |
72 "-Wl,-rpath,@loader_path/../../..", | |
73 ] | |
74 } else { | |
75 # Non-Mac Posix compiler flags setup. | |
76 # ----------------------------------- | |
77 | |
78 # CPU architecture. We may or may not be doing a cross compile now, so for | |
79 # simplicity we always explicitly set the architecture. | |
80 if (cpu_arch == "x64") { | |
81 cflags += "-m64" | |
82 ldflags += "-m64" | |
83 } else if (cpu_arch == "x86") { | |
84 cflags += "-m32" | |
85 ldflags += "-m32" | |
86 } | |
87 } | 73 } |
88 | 74 |
89 # Linux-specific compiler flags setup. | 75 cflags += common_mac_flags + [ |
90 # ------------------------------------ | 76 # Without this, the constructors and destructors of a C++ object inside |
91 if (is_linux) { | 77 # an Objective C struct won't be called, which is very bad. |
92 cflags += [ | 78 "-fobjc-call-cxx-cdtors", |
93 "-fPIC", | 79 ] |
94 "-pthread", | |
95 "-pipe", # Use pipes for communicating between sub-processes. Faster. | |
96 ] | |
97 | 80 |
98 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of | 81 cflags_c += [ "-std=c99" ] |
99 # address space, and it doesn't support cross-compiling). | 82 cflags_cc += [ "-std=gnu++11" ] |
100 if (cpu_arch == "x64") { | |
101 gold_path = rebase_path("//third_party/gold", ".", root_build_dir) | |
102 ldflags += [ | |
103 "-B$gold_path", | |
104 | 83 |
105 # There seems to be a conflict of --icf and -pie in gold which can | 84 ldflags += common_mac_flags + [ |
106 # generate crashy binaries. As a security measure, -pie takes | 85 "-L.", |
107 # precendence for now. | |
108 # TODO(brettw) common.gypi has this only for target toolset. | |
109 #"-Wl,--icf=safe", | |
110 "-Wl,--icf=none", | |
111 | 86 |
112 # Experimentation found that using four linking threads | 87 # TODO(brettW) I don't understand these options. |
113 # saved ~20% of link time. | 88 "-Wl,-rpath,@loader_path/.", |
114 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 | 89 "-Wl,-rpath,@loader_path/../../..", |
115 # Only apply this to the target linker, since the host | 90 ] |
116 # linker might not be gold, but isn't used much anyway. | 91 } else if (is_posix) { |
117 "-Wl,--threads", | 92 # Non-Mac Posix compiler flags setup. |
118 "-Wl,--thread-count=4", | 93 # ----------------------------------- |
119 ] | |
120 } | |
121 | 94 |
122 if (sysroot != "") { | 95 # CPU architecture. We may or may not be doing a cross compile now, so for |
123 cflags += "--sysroot=" + sysroot | 96 # simplicity we always explicitly set the architecture. |
124 ldflags += "--sysroot=" + sysroot | 97 if (cpu_arch == "x64") { |
| 98 cflags += "-m64" |
| 99 ldflags += "-m64" |
| 100 } else if (cpu_arch == "x86") { |
| 101 cflags += "-m32" |
| 102 ldflags += "-m32" |
| 103 } |
| 104 } |
125 | 105 |
126 # Need to get some linker flags out of the sysroot. | 106 # Linux-specific compiler flags setup. |
127 ldflags += exec_script("../linux/sysroot_ld_path.py", | 107 # ------------------------------------ |
128 [rebase_path("../../linux/sysroot_ld_path.sh", ".", root_build_dir), | 108 if (is_linux) { |
129 sysroot], | 109 cflags += [ |
130 "value") | 110 "-fPIC", |
131 } | 111 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
| 112 ] |
| 113 if (!is_android) { |
| 114 cflags += [ "-pthread" ] |
| 115 } |
132 | 116 |
| 117 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of |
| 118 # address space, and it doesn't support cross-compiling). |
| 119 if (cpu_arch == "x64") { |
| 120 gold_path = rebase_path("//third_party/gold", ".", root_build_dir) |
133 ldflags += [ | 121 ldflags += [ |
134 "-fPIC", | 122 "-B$gold_path", |
135 "-pthread", | 123 |
136 "-Wl,-z,noexecstack", | 124 # There seems to be a conflict of --icf and -pie in gold which can |
137 "-Wl,-z,now", | 125 # generate crashy binaries. As a security measure, -pie takes |
138 "-Wl,-z,relro", | 126 # precendence for now. |
| 127 # TODO(brettw) common.gypi has this only for target toolset. |
| 128 #"-Wl,--icf=safe", |
| 129 "-Wl,--icf=none", |
| 130 |
| 131 # Experimentation found that using four linking threads |
| 132 # saved ~20% of link time. |
| 133 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr
ead/thread/281527606915bb36 |
| 134 # Only apply this to the target linker, since the host |
| 135 # linker might not be gold, but isn't used much anyway. |
| 136 "-Wl,--threads", |
| 137 "-Wl,--thread-count=4", |
139 ] | 138 ] |
140 } | 139 } |
141 | 140 |
142 # Clang-specific compiler flags setup. | 141 if (sysroot != "") { |
143 # ------------------------------------ | 142 cflags += "--sysroot=" + sysroot |
144 if (is_clang) { | 143 ldflags += "--sysroot=" + sysroot |
| 144 |
| 145 # Need to get some linker flags out of the sysroot. |
| 146 ldflags += exec_script("../linux/sysroot_ld_path.py", |
| 147 [rebase_path("../../linux/sysroot_ld_path.sh", ".", root_build_dir), |
| 148 sysroot], |
| 149 "value") |
| 150 } |
| 151 |
| 152 ldflags += [ |
| 153 "-fPIC", |
| 154 "-pthread", |
| 155 "-Wl,-z,noexecstack", |
| 156 "-Wl,-z,now", |
| 157 "-Wl,-z,relro", |
| 158 ] |
| 159 } |
| 160 |
| 161 # Clang-specific compiler flags setup. |
| 162 # ------------------------------------ |
| 163 if (is_clang) { |
| 164 cflags += [ |
| 165 "-fcolor-diagnostics", |
| 166 ] |
| 167 } |
| 168 |
| 169 # Android-specific flags setup. |
| 170 # ----------------------------- |
| 171 if (is_android) { |
| 172 cflags += [ |
| 173 "-ffunction-sections", |
| 174 "-funwind-tables", |
| 175 "-fno-short-enums", |
| 176 "-finline-limit=64", |
| 177 ] |
| 178 if (is_android_webview_build) { |
| 179 # Android predefines this as 1; undefine it here so Chromium can redefine |
| 180 # it later to be 2 for chromium code and unset for third party code. This |
| 181 # works because cflags are added before defines. |
| 182 # TODO(brettw) the above comment seems incorrect. We specify defines |
| 183 # before cflags on our compiler command lines. |
| 184 cflags += [ "-U_FORTIFY_SOURCE" ] |
| 185 } |
| 186 |
| 187 if (is_asan) { |
| 188 # Android build relies on -Wl,--gc-sections removing unreachable code. |
| 189 # ASan instrumentation for globals inhibits this and results in a library |
| 190 # with unresolvable relocations. |
| 191 # TODO(eugenis): find a way to reenable this. |
| 192 cflags += [ "-mllvm -asan-globals=0" ] |
| 193 } |
| 194 |
| 195 defines += [ "ANDROID" ] |
| 196 if (!is_android_webview_build) { |
| 197 # The NDK has these things, but doesn't define the constants |
| 198 # to say that it does. Define them here instead. |
| 199 defines += [ "HAVE_SYS_UIO_H" ] |
| 200 } |
| 201 |
| 202 ldflags += [ |
| 203 "-Wl,--no-undefined", |
| 204 # Don't export symbols from statically linked libraries. |
| 205 "-Wl,--exclude-libs=ALL", |
| 206 ] |
| 207 if (cpu_arch == "arm") { |
| 208 ldflags += [ |
| 209 # Enable identical code folding to reduce size. |
| 210 "-Wl,--icf=safe", |
| 211 ] |
| 212 } |
| 213 |
| 214 if (cpu_arch == "arm") { |
145 cflags += [ | 215 cflags += [ |
146 "-fcolor-diagnostics", | 216 "-target arm-linux-androideabi", |
| 217 "-mllvm -arm-enable-ehabi", |
147 ] | 218 ] |
| 219 ldflags += [ "-target arm-linux-androideabi" ] |
| 220 } else if (cpu_arch == "x86") { |
| 221 cflags += [ "-target x86-linux-androideabi" ] |
| 222 ldflags += [ "-target x86-linux-androideabi" ] |
148 } | 223 } |
149 } | 224 } |
150 } | 225 } |
151 | 226 |
152 # runtime_library ------------------------------------------------------------- | 227 # runtime_library ------------------------------------------------------------- |
153 # | 228 # |
154 # Sets the runtime library and associated options. | 229 # Sets the runtime library and associated options. |
155 # | 230 # |
156 # We don't bother making multiple versions that are toggle-able since there | 231 # How do you determine what should go in here vs. "compiler" above? Consider if |
157 # is more than one axis of control (which makes it complicated) and there's | 232 # a target might choose to use a different runtime library (ignore for a moment |
158 # no practical reason for anybody to change this since the CRT must agree. | 233 # if this is possible or reasonable on your system). If such a target would want |
| 234 # to change or remove your option, put it in the runtime_library config. If a |
| 235 # target wants the option regardless, put it in the compiler config. |
159 | 236 |
160 config("runtime_library") { | 237 config("runtime_library") { |
| 238 cflags = [] |
| 239 defines = [] |
| 240 ldflags = [] |
| 241 lib_dirs = [] |
| 242 libs = [] |
| 243 |
161 if (is_component_build) { | 244 if (is_component_build) { |
162 # Component mode: dynamic CRT. | 245 # Component mode: dynamic CRT. |
163 defines = [ "COMPONENT_BUILD" ] | 246 defines += [ "COMPONENT_BUILD" ] |
164 if (is_win) { | 247 if (is_win) { |
165 # Since the library is shared, it requires exceptions or will give errors | 248 # Since the library is shared, it requires exceptions or will give errors |
166 # about things not matching, so keep exceptions on. | 249 # about things not matching, so keep exceptions on. |
167 if (is_debug) { | 250 if (is_debug) { |
168 cflags = [ "/MDd" ] | 251 cflags += [ "/MDd" ] |
169 } else { | 252 } else { |
170 cflags = [ "/MD" ] | 253 cflags += [ "/MD" ] |
171 } | 254 } |
172 } | 255 } |
173 } else { | 256 } else { |
174 # Static CRT. | 257 # Static CRT. |
175 if (is_win) { | 258 if (is_win) { |
176 # We don't use exceptions, and when we link statically we can just get | 259 # We don't use exceptions, and when we link statically we can just get |
177 # rid of them entirely. | 260 # rid of them entirely. |
178 defines = [ "_HAS_EXCEPTIONS=0" ] | 261 defines += [ "_HAS_EXCEPTIONS=0" ] |
179 if (is_debug) { | 262 if (is_debug) { |
180 cflags = [ "/MTd" ] | 263 cflags += [ "/MTd" ] |
181 } else { | 264 } else { |
182 cflags = [ "/MT" ] | 265 cflags += [ "/MT" ] |
183 } | 266 } |
184 } | 267 } |
185 } | 268 } |
186 | 269 |
187 if (is_win) { | 270 if (is_win) { |
188 defines += [ | 271 defines += [ |
189 "__STD_C", | 272 "__STD_C", |
190 "__STDC_CONSTANT_MACROS", | 273 "__STDC_CONSTANT_MACROS", |
191 "__STDC_FORMAT_MACROS", | 274 "__STDC_FORMAT_MACROS", |
192 "_CRT_RAND_S", | 275 "_CRT_RAND_S", |
193 "_CRT_SECURE_NO_DEPRECATE", | 276 "_CRT_SECURE_NO_DEPRECATE", |
194 "_SCL_SECURE_NO_DEPRECATE", | 277 "_SCL_SECURE_NO_DEPRECATE", |
195 "_UNICODE", | 278 "_UNICODE", |
196 "UNICODE", | 279 "UNICODE", |
197 ] | 280 ] |
198 } | 281 } |
| 282 |
| 283 # Stlport setup. Android uses a different (smaller) version of the STL. |
| 284 if (is_android) { |
| 285 if (is_clang) { |
| 286 # Work around incompatibilities between bionic and clang headers. |
| 287 defines += [ |
| 288 "__compiler_offsetof=__builtin_offsetof", |
| 289 "-Dnan=__builtin_nan", |
| 290 ] |
| 291 } |
| 292 |
| 293 defines += [ |
| 294 "USE_STLPORT=1", |
| 295 "_STLP_USE_PTR_SPECIALIZATIONS=1", |
| 296 "__GNU_SOURCE=1", # Necessary for clone(). |
| 297 ] |
| 298 |
| 299 ldflags += [ |
| 300 "-nostdlib", |
| 301 ] |
| 302 |
| 303 libs += [ |
| 304 # TODO(brettw) write a version of this, hopefully we can express this |
| 305 # without forking out to GCC just to get the library name. The android |
| 306 # toolchain directory should probably be extracted into a .gni file that |
| 307 # this file and the android toolchain .gn file can share. |
| 308 # # Manually link the libgcc.a that the cross compiler uses. |
| 309 # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)', |
| 310 "c", |
| 311 "dl", |
| 312 "m" |
| 313 ] |
| 314 |
| 315 # NOTE: The stlport header include paths below are specified in cflags |
| 316 # rather than include_dirs because they need to come after include_dirs. |
| 317 # Think of them like system headers, but don't use '-isystem' because the |
| 318 # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit |
| 319 # strange errors. The include ordering here is important; change with |
| 320 # caution. |
| 321 if (use_system_stlport) { |
| 322 cflags += [ |
| 323 # For libstdc++/include, which is used by stlport. |
| 324 "-I$android_src/bionic", |
| 325 "-I$android_src/external/stlport/stlport", |
| 326 ] |
| 327 libs += [ |
| 328 "stlport", |
| 329 ] |
| 330 } else { |
| 331 android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport" |
| 332 |
| 333 cflags += [ "-I$android_stlport_root/stlport" ] |
| 334 lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ] |
| 335 |
| 336 if (component_mode == "shared_library") { |
| 337 libs += [ "stlport_shared" ] |
| 338 } else { |
| 339 libs += [ "stlport_static" ] |
| 340 } |
| 341 } |
| 342 } |
199 } | 343 } |
200 | 344 |
201 # chromium_code --------------------------------------------------------------- | 345 # chromium_code --------------------------------------------------------------- |
202 # | 346 # |
203 # Toggles between higher and lower warnings for code that is (or isn't) | 347 # Toggles between higher and lower warnings for code that is (or isn't) |
204 # part of Chromium. | 348 # part of Chromium. |
205 | 349 |
206 config("chromium_code") { | 350 config("chromium_code") { |
207 if (is_win) { | 351 if (is_win) { |
208 cflags = [ | 352 cflags = [ |
(...skipping 30 matching lines...) Expand all Loading... |
239 if (is_win) { | 383 if (is_win) { |
240 cflags = [ | 384 cflags = [ |
241 "/W3", # Warning level 3. | 385 "/W3", # Warning level 3. |
242 "/wd4800", # Disable warning when forcing value to bool. | 386 "/wd4800", # Disable warning when forcing value to bool. |
243 ] | 387 ] |
244 defines = [ | 388 defines = [ |
245 "_CRT_NONSTDC_NO_WARNINGS", | 389 "_CRT_NONSTDC_NO_WARNINGS", |
246 "_CRT_NONSTDC_NO_DEPRECATE", | 390 "_CRT_NONSTDC_NO_DEPRECATE", |
247 ] | 391 ] |
248 } | 392 } |
| 393 |
| 394 if (is_android_webview_build) { |
| 395 # There is a class of warning which: |
| 396 # 1) Android always enables and also treats as errors |
| 397 # 2) Chromium ignores in third party code |
| 398 # So we re-enable those warnings when building Android. |
| 399 cflags = [ |
| 400 "-Wno-address", |
| 401 "-Wno-format-security", |
| 402 "-Wno-return-type", |
| 403 "-Wno-sequence-point", |
| 404 ] |
| 405 cflags_cc = [ "-Wno-non-virtual-dtor" ] |
| 406 } |
249 } | 407 } |
250 | 408 |
251 # rtti ------------------------------------------------------------------------ | 409 # rtti ------------------------------------------------------------------------ |
252 # | 410 # |
253 # Allows turning Run-Time Type Identification on or off. | 411 # Allows turning Run-Time Type Identification on or off. |
254 | 412 |
255 config("rtti") { | 413 config("rtti") { |
256 if (is_win) { | 414 if (is_win) { |
257 cflags_cc = [ "/GR" ] | 415 cflags_cc = [ "/GR" ] |
258 } | 416 } |
259 } | 417 } |
260 config("no_rtti") { | 418 config("no_rtti") { |
261 if (is_win) { | 419 if (is_win) { |
262 cflags_cc = [ "/GR-" ] | 420 cflags_cc = [ "/GR-" ] |
263 } else { | 421 } else { |
264 cflags_cc = [ "-fno-rtti" ] | 422 cflags_cc = [ "-fno-rtti" ] |
265 } | 423 } |
266 } | 424 } |
267 | 425 |
268 # Warnings --------------------------------------------------------------------- | 426 # Warnings --------------------------------------------------------------------- |
| 427 # |
| 428 # This is where we disable various warnings that we've decided aren't |
| 429 # worthwhile. |
269 | 430 |
270 config("default_warnings") { | 431 config("default_warnings") { |
271 if (is_win) { | 432 if (is_win) { |
272 # Please keep ordered and add names if you add more. | 433 # Please keep ordered and add names if you add more. |
273 cflags = [ | 434 cflags = [ |
274 "/wd4018", # Comparing signed and unsigned values. | 435 "/wd4018", # Comparing signed and unsigned values. |
275 "/wd4100", # Unreferenced formal function parameter. | 436 "/wd4100", # Unreferenced formal function parameter. |
276 "/wd4121", # Alignment of a member was sensitive to packing. | 437 "/wd4121", # Alignment of a member was sensitive to packing. |
277 "/wd4125", # Decimal digit terminates octal escape sequence. | 438 "/wd4125", # Decimal digit terminates octal escape sequence. |
278 "/wd4127", # Conditional expression is constant. | 439 "/wd4127", # Conditional expression is constant. |
279 "/wd4130", # Logical operation on address of string constant. | 440 "/wd4130", # Logical operation on address of string constant. |
280 # TODO(brettw) is this necessary? If so, it should probably be on whoever | |
281 # is silly enough to be doing this rather than globally. | |
282 #"/wd4131", # Function uses old-style declarator. | |
283 "/wd4189", # A variable was declared and initialized but never used. | 441 "/wd4189", # A variable was declared and initialized but never used. |
284 "/wd4201", # Nonstandard extension used: nameless struct/union. | 442 "/wd4201", # Nonstandard extension used: nameless struct/union. |
285 "/wd4238", # Nonstandard extension used: class rvalue used as lvalue. | 443 "/wd4238", # Nonstandard extension used: class rvalue used as lvalue. |
286 "/wd4244", # Conversion: possible loss of data. | 444 "/wd4244", # Conversion: possible loss of data. |
287 "/wd4245", # Conversion: signed/unsigned mismatch, | 445 "/wd4245", # Conversion: signed/unsigned mismatch, |
288 "/wd4251", # Class needs to have dll-interface. | 446 "/wd4251", # Class needs to have dll-interface. |
289 "/wd4310", # Cast truncates constant value. | 447 "/wd4310", # Cast truncates constant value. |
290 "/wd4351", # Elements of array will be default initialized. | 448 "/wd4351", # Elements of array will be default initialized. |
291 "/wd4355", # 'this' used in base member initializer list. | 449 "/wd4355", # 'this' used in base member initializer list. |
292 "/wd4396", # Inline friend template thing. | 450 "/wd4396", # Inline friend template thing. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 # http://crbug.com/255186 | 506 # http://crbug.com/255186 |
349 "-Wno-deprecated-register", | 507 "-Wno-deprecated-register", |
350 | 508 |
351 # Clang spots more unused functions. | 509 # Clang spots more unused functions. |
352 "-Wno-unused-function", | 510 "-Wno-unused-function", |
353 | 511 |
354 # Warns when a const char[] is converted to bool. | 512 # Warns when a const char[] is converted to bool. |
355 "-Wstring-conversion", | 513 "-Wstring-conversion", |
356 ] | 514 ] |
357 } | 515 } |
| 516 |
| 517 if (is_android) { |
| 518 # Disable any additional warnings enabled by the Android build system but |
| 519 # which chromium does not build cleanly with (when treating warning as |
| 520 # errors). |
| 521 cflags += [ |
| 522 "-Wno-extra", |
| 523 "-Wno-ignored-qualifiers", |
| 524 "-Wno-type-limits", |
| 525 ] |
| 526 cflags_cc = [ |
| 527 # Disabling c++0x-compat should be handled in WebKit, but |
| 528 # this currently doesn't work because gcc_version is not set |
| 529 # correctly when building with the Android build system. |
| 530 # TODO(torne): Fix this in WebKit. |
| 531 "-Wno-error=c++0x-compat", |
| 532 # Other things unrelated to -Wextra: |
| 533 "-Wno-non-virtual-dtor", |
| 534 "-Wno-sign-promo", |
| 535 ] |
| 536 } |
358 } | 537 } |
359 } | 538 } |
360 | 539 |
361 # Optimization ----------------------------------------------------------------- | 540 # Optimization ----------------------------------------------------------------- |
362 | 541 |
363 config("optimize") { | 542 config("optimize") { |
364 if (is_win) { | 543 if (is_win) { |
365 cflags = [ | 544 cflags = [ |
366 "/O2", | 545 "/O2", |
367 "/Ob2", # Both explicit and auto inlining. | 546 "/Ob2", # Both explicit and auto inlining. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } else { | 591 } else { |
413 cflags = [ "-g1" ] | 592 cflags = [ "-g1" ] |
414 } | 593 } |
415 } | 594 } |
416 | 595 |
417 config("no_symbols") { | 596 config("no_symbols") { |
418 if (!is_win) { | 597 if (!is_win) { |
419 cflags = [ "-g0" ] | 598 cflags = [ "-g0" ] |
420 } | 599 } |
421 } | 600 } |
OLD | NEW |