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/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 if (current_cpu == "arm") { | 7 if (current_cpu == "arm") { |
8 import("//build/config/arm.gni") | 8 import("//build/config/arm.gni") |
9 } | 9 } |
10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 # Allow comparing the address of references and 'this' against 0 | 151 # Allow comparing the address of references and 'this' against 0 |
152 # in debug builds. Technically, these can never be null in | 152 # in debug builds. Technically, these can never be null in |
153 # well-defined C/C++ and Clang can optimize such checks away in | 153 # well-defined C/C++ and Clang can optimize such checks away in |
154 # release builds, but they may be used in asserts in debug builds. | 154 # release builds, but they may be used in asserts in debug builds. |
155 cflags_cc += [ | 155 cflags_cc += [ |
156 "-Wno-undefined-bool-conversion", | 156 "-Wno-undefined-bool-conversion", |
157 "-Wno-tautological-undefined-compare", | 157 "-Wno-tautological-undefined-compare", |
158 ] | 158 ] |
159 } | 159 } |
160 | 160 |
161 if (is_clang && !is_win && !is_nacl) { | 161 if (is_clang && !is_nacl) { |
162 # This is here so that all files get recompiled after a clang roll and | 162 # This is here so that all files get recompiled after a clang roll and |
163 # when turning clang on or off. (defines are passed via the command line, | 163 # when turning clang on or off. (defines are passed via the command line, |
164 # and build system rebuild things when their commandline changes). Nothing | 164 # and build system rebuild things when their commandline changes). Nothing |
165 # should ever read this define. | 165 # should ever read this define. |
166 defines += [ "CR_CLANG_REVISION=" + | 166 defines += |
167 exec_script("//tools/clang/scripts/posix-print-revision.py", | 167 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", |
168 [], | 168 [ "--print-revision" ], |
169 "trim string") ] | 169 "trim string") ] |
170 } | 170 } |
171 | 171 |
172 # Mac-specific compiler flags setup. | 172 # Mac-specific compiler flags setup. |
173 # ---------------------------------- | 173 # ---------------------------------- |
174 if (is_mac || is_ios) { | 174 if (is_mac || is_ios) { |
175 # These flags are shared between the C compiler and linker. | 175 # These flags are shared between the C compiler and linker. |
176 common_mac_flags = [] | 176 common_mac_flags = [] |
177 | 177 |
178 # CPU architecture. | 178 # CPU architecture. |
179 if (current_cpu == "x64") { | 179 if (current_cpu == "x64") { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ] | 329 ] |
330 } | 330 } |
331 | 331 |
332 # Omit unwind support in official builds to save space. We can use breakpad | 332 # Omit unwind support in official builds to save space. We can use breakpad |
333 # for these builds. | 333 # for these builds. |
334 if (is_chrome_branded && is_official_build) { | 334 if (is_chrome_branded && is_official_build) { |
335 cflags += [ | 335 cflags += [ |
336 "-fno-unwind-tables", | 336 "-fno-unwind-tables", |
337 "-fno-asynchronous-unwind-tables", | 337 "-fno-asynchronous-unwind-tables", |
338 ] | 338 ] |
| 339 defines += [ "NO_UNWIND_TABLES" ] |
339 } else { | 340 } else { |
340 cflags += [ "-funwind-tables" ] | 341 cflags += [ "-funwind-tables" ] |
341 } | 342 } |
342 } | 343 } |
343 | 344 |
344 # Linux/Android common flags setup. | 345 # Linux/Android common flags setup. |
345 # --------------------------------- | 346 # --------------------------------- |
346 if (is_linux || is_android) { | 347 if (is_linux || is_android) { |
347 cflags += [ | 348 cflags += [ |
348 "-fPIC", | 349 "-fPIC", |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 # http://code.google.com/p/chromium/issues/detail?id=90453 | 630 # http://code.google.com/p/chromium/issues/detail?id=90453 |
630 "-Wsign-compare", | 631 "-Wsign-compare", |
631 ] | 632 ] |
632 | 633 |
633 # In Chromium code, we define __STDC_foo_MACROS in order to get the | 634 # In Chromium code, we define __STDC_foo_MACROS in order to get the |
634 # C99 macros on Mac and Linux. | 635 # C99 macros on Mac and Linux. |
635 defines = [ | 636 defines = [ |
636 "__STDC_CONSTANT_MACROS", | 637 "__STDC_CONSTANT_MACROS", |
637 "__STDC_FORMAT_MACROS", | 638 "__STDC_FORMAT_MACROS", |
638 ] | 639 ] |
| 640 |
| 641 if (using_sanitizer) { |
| 642 # _FORTIFY_SOURCE isn't really supported by Clang now, see |
| 643 # http://llvm.org/bugs/show_bug.cgi?id=16821. |
| 644 # It seems to work fine with Ubuntu 12 headers though, so use it in |
| 645 # official builds. |
| 646 # |
| 647 # Non-chromium code is not guaranteed to compile cleanly with |
| 648 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
| 649 # disabled, so only do that for Release build. |
| 650 defines += [ "_FORTIFY_SOURCE=2" ] |
| 651 } |
639 } | 652 } |
640 } | 653 } |
641 config("no_chromium_code") { | 654 config("no_chromium_code") { |
642 cflags = [] | 655 cflags = [] |
643 cflags_cc = [] | 656 cflags_cc = [] |
644 defines = [] | 657 defines = [] |
645 | 658 |
646 if (is_win) { | 659 if (is_win) { |
647 cflags += [ | 660 cflags += [ |
648 "/W3", # Warning level 3. | 661 "/W3", # Warning level 3. |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 cflags += [ "-gsplit-dwarf" ] | 1100 cflags += [ "-gsplit-dwarf" ] |
1088 } | 1101 } |
1089 } | 1102 } |
1090 } | 1103 } |
1091 | 1104 |
1092 config("no_symbols") { | 1105 config("no_symbols") { |
1093 if (!is_win) { | 1106 if (!is_win) { |
1094 cflags = [ "-g0" ] | 1107 cflags = [ "-g0" ] |
1095 } | 1108 } |
1096 } | 1109 } |
OLD | NEW |