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 if (cpu_arch == "arm") { | 6 if (cpu_arch == "arm") { |
7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
8 } | 8 } |
9 if (is_posix) { | 9 if (is_posix) { |
10 import("//build/config/gcc/gcc_version.gni") | 10 import("//build/config/gcc/gcc_version.gni") |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 # GCC flags, and then we handle the other non-Windows platforms specifically | 47 # GCC flags, and then we handle the other non-Windows platforms specifically |
48 # below. | 48 # below. |
49 if (is_win) { | 49 if (is_win) { |
50 # Windows compiler flags setup. | 50 # Windows compiler flags setup. |
51 # ----------------------------- | 51 # ----------------------------- |
52 cflags += [ | 52 cflags += [ |
53 "/Gy", # Enable function-level linking. | 53 "/Gy", # Enable function-level linking. |
54 "/GS", # Enable buffer security checking. | 54 "/GS", # Enable buffer security checking. |
55 "/FS", # Preserve previous PDB behavior. | 55 "/FS", # Preserve previous PDB behavior. |
56 ] | 56 ] |
57 if (is_component_build) { | |
58 cflags += [ | |
59 "/EHsc", # Assume C functions can't throw exceptions and don't catch | |
60 # structured exceptions (only C++ ones). | |
61 ] | |
62 } | |
63 } else { | 57 } else { |
64 # Common GCC compiler flags setup. | 58 # Common GCC compiler flags setup. |
65 # -------------------------------- | 59 # -------------------------------- |
66 cflags += [ | 60 cflags += [ |
67 "-fno-strict-aliasing", # See http://crbug.com/32204 | 61 "-fno-strict-aliasing", # See http://crbug.com/32204 |
68 ] | 62 ] |
69 cflags_cc += [ | 63 cflags_cc += [ |
70 "-fno-threadsafe-statics", | 64 "-fno-threadsafe-statics", |
71 # Not exporting C++ inline functions can generally be applied anywhere | 65 # Not exporting C++ inline functions can generally be applied anywhere |
72 # so we do so here. Normal function visibility is controlled by | 66 # so we do so here. Normal function visibility is controlled by |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 # about things not matching, so keep exceptions on. | 340 # about things not matching, so keep exceptions on. |
347 if (is_debug) { | 341 if (is_debug) { |
348 cflags += [ "/MDd" ] | 342 cflags += [ "/MDd" ] |
349 } else { | 343 } else { |
350 cflags += [ "/MD" ] | 344 cflags += [ "/MD" ] |
351 } | 345 } |
352 } | 346 } |
353 } else { | 347 } else { |
354 # Static CRT. | 348 # Static CRT. |
355 if (is_win) { | 349 if (is_win) { |
356 # We don't use exceptions, and when we link statically we can just get | |
357 # rid of them entirely. | |
358 defines += [ "_HAS_EXCEPTIONS=0" ] | |
359 if (is_debug) { | 350 if (is_debug) { |
360 cflags += [ "/MTd" ] | 351 cflags += [ "/MTd" ] |
361 } else { | 352 } else { |
362 cflags += [ "/MT" ] | 353 cflags += [ "/MT" ] |
363 } | 354 } |
364 } | 355 } |
365 } | 356 } |
366 | 357 |
367 if (is_win) { | 358 if (is_win) { |
368 defines += [ | 359 defines += [ |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 547 } |
557 } | 548 } |
558 config("no_rtti") { | 549 config("no_rtti") { |
559 if (is_win) { | 550 if (is_win) { |
560 cflags_cc = [ "/GR-" ] | 551 cflags_cc = [ "/GR-" ] |
561 } else { | 552 } else { |
562 cflags_cc = [ "-fno-rtti" ] | 553 cflags_cc = [ "-fno-rtti" ] |
563 } | 554 } |
564 } | 555 } |
565 | 556 |
| 557 # Exceptions ------------------------------------------------------------------- |
| 558 |
| 559 # Some code requires turning exceptions back on (off is the default). |
| 560 |
| 561 config("no_exceptions") { |
| 562 if (is_win) { |
| 563 defines = [ "_HAS_EXCEPTIONS=0" ] |
| 564 } else if (is_posix) { |
| 565 cflags_cc = [ "-fno-exceptions" ] |
| 566 } |
| 567 } |
| 568 |
| 569 config("exceptions") { |
| 570 if (is_win) { |
| 571 cflags = [ |
| 572 "/EHsc", # Assume C functions can't throw exceptions and don't catch |
| 573 # structured exceptions (only C++ ones). |
| 574 ] |
| 575 } |
| 576 } |
| 577 |
566 # Warnings --------------------------------------------------------------------- | 578 # Warnings --------------------------------------------------------------------- |
567 # | 579 # |
568 # This is where we disable various warnings that we've decided aren't | 580 # This is where we disable various warnings that we've decided aren't |
569 # worthwhile, and enable special warnings. | 581 # worthwhile, and enable special warnings. |
570 | 582 |
571 config("default_warnings") { | 583 config("default_warnings") { |
572 if (is_win) { | 584 if (is_win) { |
573 cflags = [ | 585 cflags = [ |
574 "/WX", # Treat warnings as errors. | 586 "/WX", # Treat warnings as errors. |
575 | 587 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 } else { | 902 } else { |
891 cflags = [ "-g1" ] | 903 cflags = [ "-g1" ] |
892 } | 904 } |
893 } | 905 } |
894 | 906 |
895 config("no_symbols") { | 907 config("no_symbols") { |
896 if (!is_win) { | 908 if (!is_win) { |
897 cflags = [ "-g0" ] | 909 cflags = [ "-g0" ] |
898 } | 910 } |
899 } | 911 } |
OLD | NEW |