OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 # runtime_library ------------------------------------------------------------- | |
6 # | |
7 # Sets the runtime library and associated options. | |
8 # | |
9 # We don't bother making multiple versions that are toggle-able since there | |
10 # is more than one axis of control (which makes it complicated) and there's | |
11 # no practical reason for anybody to change this since the CRT must agree. | |
12 | |
13 config("runtime_library") { | |
14 if (is_component_build) { | |
15 # Component mode: dynamic CRT. | |
16 defines = [ "COMPONENT_BUILD" ] | |
17 if (is_win) { | |
18 # Since the library is shared, it requires exceptions or will give errors | |
19 # about things not matching, so keep exceptions on. | |
20 if (is_debug) { | |
21 cflags = [ "/MDd" ] | |
22 } else { | |
23 cflags = [ "/MD" ] | |
24 } | |
25 } | |
26 } else { | |
27 # Static CRT. | |
28 if (is_win) { | |
29 # We don't use exceptions, and when we link statically we can just get | |
30 # rid of them entirely. | |
31 defines = [ "_HAS_EXCEPTIONS=0" ] | |
32 if (is_debug) { | |
33 cflags = [ "/MTd" ] | |
34 } else { | |
35 cflags = [ "/MT" ] | |
36 } | |
37 } | |
38 } | |
39 | |
40 if (is_win) { | |
41 defines += [ | |
42 "__STD_C", | |
43 "__STDC_CONSTANT_MACROS", | |
44 "__STDC_FORMAT_MACROS", | |
45 "_CRT_RAND_S", | |
46 "_CRT_SECURE_NO_DEPRECATE", | |
47 "_SCL_SECURE_NO_DEPRECATE", | |
48 "_UNICODE", | |
49 "UNICODE", | |
50 ] | |
51 } | |
52 } | |
53 | |
54 # chromium_code --------------------------------------------------------------- | |
55 # | |
56 # Toggles between higher and lower warnings for code that is (or isn't) | |
57 # part of Chromium. | |
58 | |
59 config("chromium_code") { | |
60 if (is_win) { | |
61 cflags = [ | |
62 "/W4", # Warning level 4. | |
63 ] | |
64 } | |
65 } | |
66 config("no_chromium_code") { | |
67 if (is_win) { | |
68 cflags = [ | |
69 "/W3", # Warning level 3. | |
70 "/wd4800", # Disable warning when forcing value to bool. | |
71 ] | |
72 defines = [ | |
73 "_CRT_NONSTDC_NO_WARNINGS", | |
74 "_CRT_NONSTDC_NO_DEPRECATE", | |
75 ] | |
76 } | |
77 } | |
78 | |
79 # rtti ------------------------------------------------------------------------ | |
80 # | |
81 # Allows turning Run-Time Type Identification on or off. | |
82 | |
83 config("rtti") { | |
84 if (is_win) { | |
85 cflags = [ "/GR" ] | |
86 } | |
87 } | |
88 config("no_rtti") { | |
89 if (is_win) { | |
90 cflags = [ "/GR-" ] | |
91 } | |
92 } | |
93 | |
94 # Warnings --------------------------------------------------------------------- | |
95 | |
96 config("disable_annoying_warnings") { | |
97 if (is_win) { | |
98 # Please keep ordered and add names if you add more. | |
99 cflags = [ | |
100 "/wd4018", # Comparing signed and unsigned values. | |
101 "/wd4100", # Unreferenced formal function parameter. | |
102 "/wd4121", # Alignment of a member was sensitive to packing. | |
103 "/wd4125", # Decimal digit terminates octal escape sequence. | |
104 "/wd4127", # Conditional expression is constant. | |
105 "/wd4130", # Logical operation on address of string constant. | |
106 # TODO(brettw) is this necessary? If so, it should probably be on whoever | |
107 # is silly enough to be doing this rather than globally. | |
108 #"/wd4131", # Function uses old-style declarator. | |
109 "/wd4189", # A variable was declared and initialized but never used. | |
110 "/wd4201", # Nonstandard extension used: nameless struct/union. | |
111 "/wd4238", # Nonstandard extension used: class rvalue used as lvalue. | |
112 "/wd4244", # Conversion: possible loss of data. | |
113 "/wd4245", # Conversion: signed/unsigned mismatch, | |
114 "/wd4251", # Class needs to have dll-interface. | |
115 "/wd4310", # Cast truncates constant value. | |
116 "/wd4351", # Elements of array will be default initialized. | |
117 "/wd4355", # 'this' used in base member initializer list. | |
118 "/wd4396", # Inline friend template thing. | |
119 "/wd4428", # Universal character name encountered in source. | |
120 "/wd4481", # Nonstandard extension: override specifier. | |
121 "/wd4503", # Decorated name length exceeded, name was truncated. | |
122 "/wd4505", # Unreferenced local function has been removed. | |
123 "/wd4510", # Default constructor could not be generated. | |
124 "/wd4512", # Assignment operator could not be generated. | |
125 "/wd4530", # Exception handler used, but unwind semantics not enabled. | |
126 "/wd4610", # Class can never be instantiated, constructor required. | |
127 "/wd4611", # C++ object destruction and 'catch'. | |
128 "/wd4701", # Potentially uninitialized local variable name used. | |
129 "/wd4702", # Unreachable code. | |
130 "/wd4706", # Assignment within conditional expression. | |
131 "/wd4819", # Character not in the current code page. | |
132 ] | |
133 } | |
134 } | |
OLD | NEW |