aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/compilers/msvc_compiler.conf
blob: d09d51d8bdd37b24b13637b50a66a7e0c0acc75b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
_MSVC_MACRO=_WIN32_WINNT 
_MSVC_WINDOWS7=0x0601 
_MSVC_WINDOWS8=0x0602 
 
_MSVC_WARNS_ENABLED= 
# 'expression' : signed/unsigned mismatch 
_MSVC_WARNS_ENABLED+=/w14018 
# 'class' : class has virtual functions, but destructor is not virtual 
_MSVC_WARNS_ENABLED+=/w14265 
# 'operator' : expression is always false 
_MSVC_WARNS_ENABLED+=/w14296 
# missing type specifier - int assumed 
_MSVC_WARNS_ENABLED+=/w14431 
 
_MSVC_WARNS_AS_ERRORS= 
# 'function' undefined; assuming extern returning int 
_MSVC_WARNS_AS_ERRORS+=/we4013 
 
_MSVC_WARNS_DISABLED= 
# conditional expression is constant 
_MSVC_WARNS_DISABLED+=/wd4127 
# nonstandard extension used : zero-sized array in struct/union 
_MSVC_WARNS_DISABLED+=/wd4200 
# nonstandard extension used : nameless struct/union 
_MSVC_WARNS_DISABLED+=/wd4201 
# elements of array will be default initialized 
_MSVC_WARNS_DISABLED+=/wd4351 
# 'this' : used in base member initializer list 
_MSVC_WARNS_DISABLED+=/wd4355 
# decorated name length exceeded, name was truncated 
_MSVC_WARNS_DISABLED+=/wd4503 
# default constructor could not be generated 
_MSVC_WARNS_DISABLED+=/wd4510 
# copy constructor could not be generated 
_MSVC_WARNS_DISABLED+=/wd4511 
# assignment operator could not be generated 
_MSVC_WARNS_DISABLED+=/wd4512 
# check operator precedence for possible error; use parentheses to clarify precedence 
_MSVC_WARNS_DISABLED+=/wd4554 
# 'object' can never be instantiated - user defined constructor required 
_MSVC_WARNS_DISABLED+=/wd4610 
# assignment within conditional expression 
_MSVC_WARNS_DISABLED+=/wd4706 
# forcing value to bool 'true' or 'false' (performance warning) 
_MSVC_WARNS_DISABLED+=/wd4800 
# The POSIX name for this item is deprecated 
_MSVC_WARNS_DISABLED+=/wd4996 
# function marked as __forceinline not inlined 
_MSVC_WARNS_DISABLED+=/wd4714 
# 'TAtomic' : top-level volatile in cast is ignored 
_MSVC_WARNS_DISABLED+=/wd4197 
# 'initializing' : conversion from 'int' to 'ui32', signed/unsigned mismatch 
_MSVC_WARNS_DISABLED+=/wd4245 
# 'ystd::function<void (uint8_t *)>': structure was padded due to alignment specifier 
_MSVC_WARNS_DISABLED+=/wd4324 
# 'register' is no longer a supported storage class 
_MSVC_WARNS_DISABLED+=/wd5033 
 
_C_WARNINGS_CLANG_CL= 
_CXX_WARNINGS_CLANG_CL= 
_CXX_WARNINGS_CLANG_CL_2019= 
_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS= 
when ($CLANG_CL == "yes") { 
    _C_WARNINGS_CLANG_CL=\ 
-Wno-absolute-value \ 
-Wno-bitwise-op-parentheses \ 
-Wno-dll-attribute-on-redeclaration \ 
-Wno-extern-initializer \ 
-Wno-format \ 
-Wno-ignored-pragma-optimize \ 
-Wno-inconsistent-dllimport \ 
-Wno-int-conversion \ 
-Wno-int-to-void-pointer-cast \ 
-Wno-invalid-noreturn \ 
-Wno-logical-op-parentheses \ 
-Wno-macro-redefined \ 
-Wno-parentheses \ 
-Wno-pragma-pack \ 
-Wno-tautological-constant-out-of-range-compare \ 
-Wno-unknown-argument \ 
-Wno-unknown-warning-option 
 
    _CXX_WARNINGS_CLANG_CL=\ 
-Woverloaded-virtual \ 
-Wno-attributes 
    # IGNIETFERRO-722 needed for contrib 
    _CXX_WARNINGS_CLANG_CL+=-Wno-register 
 
    _CXX_WARNINGS_CLANG_CL+=\ 
-Wimport-preprocessor-directive-pedantic \ 
-Wno-undefined-var-template 
 
    when ($_TC_VERSION_AT_LEAST_2019 == "yes") { 
        _CXX_WARNINGS_CLANG_CL_2019=\ 
-Wno-deprecated-volatile \ 
-Wno-deprecated-anon-enum-enum-conversion \ 
-Wno-defaulted-function-deleted \ 
-Wno-deprecated-enum-enum-conversion \ 
-Wno-ambiguous-reversed-operator \ 
-Wno-deprecated-enum-float-conversion \ 
-Wno-pointer-to-int-cast 
    } 
 
    when ($IDE_MSVS == "yes") { 
        _CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS=-Wno-unused-command-line-argument 
    } 
} 
 
_C_WARNINGS =$_MSVC_WARNS_AS_ERRORS 
_C_WARNINGS+=$_MSVC_WARNS_ENABLED 
_C_WARNINGS+=$_MSVC_WARNS_DISABLED 
_C_WARNINGS+=$_C_WARNINGS_CLANG_CL 
 
_CXX_WARNINGS = 
_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL 
_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019 
_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS 
 
_WINAPI_UNICODE=no 
 
_DEFINES_ARCH= 
when ($ARCH_X86_64 == "yes") { 
    _DEFINES_ARCH=/D_WIN64 /DWIN64 
} 
elsewhen ($ARCH_ARMV7 == "yes") { 
    _DEFINES_ARCH=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /D__arm__ 
} 
 
_DEFINES_WIN32_WINNT=/D$_MSVC_MACRO=$_MSVC_WINDOWS7 
 
when ($_WINAPI_UNICODE == "yes") { 
    _DEFINES_UNICODE=/DUNICODE /D_UNICODE 
} 
otherwise { 
    _DEFINES_UNICODE=/D_MBCS 
} 
 
_C_DEFINES=\ 
/DARCADIA_ROOT=${ARCADIA_ROOT} \ 
/DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ 
/DFAKEID=$CPP_FAKEID \ 
/DWIN32 \ 
/D_WIN32 \ 
/D_WINDOWS \ 
/D_CRT_SECURE_NO_WARNINGS \ 
/D_CRT_NONSTDC_NO_WARNINGS \ 
/D_USE_MATH_DEFINES \ 
/D__STDC_CONSTANT_MACROS \ 
/D__STDC_FORMAT_MACROS \ 
/D_USING_V110_SDK71_ \ 
/D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ 
/DNOMINMAX \ 
/DWIN32_LEAN_AND_MEAN 
 
_C_DEFINES+=$_DEFINES_ARCH 
_C_DEFINES+=$_DEFINES_WIN32_WINNT 
_C_DEFINES+=$_DEFINES_UNICODE 
 
C_DEFINES+=$_C_DEFINES 
 
_MSVC_FLAGS_CLANG= 
_MSVC_FLAGS_CLANG_NO_WARNINGS= 
_MSVC_FLAGS_CLANG_ARCH= 
_MSVC_FLAGS_CLANG_EQ_2019= 
when ($CLANG_CL == "yes") { 
    # -fcase-insensitive-paths 
    # Allow <windows.h> to be included via <Windows.h> in case-sensitive file-systems. 
    # 
    # -fno-common 
    # Enable standard-conforming behavior and generate duplicate symbol error in case of duplicated global constants. 
    # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678#c0 
    _MSVC_FLAGS_CLANG=-fcase-insensitive-paths -fno-common 
    when ($ARCH_X86_64 == "yes") { 
        _MSVC_FLAGS_CLANG_ARCH=-m64 
    } 
    elsewhen ($ARCH_I386 == "yes") { 
        _MSVC_FLAGS_CLANG_ARCH=-m32 
    } 
    otherwise { 
        _MSVC_FLAGS_CLANG_ARCH= 
    } 
 
    # Some warnings are getting triggered even when NO_COMPILER_WARNINGS is enabled 
    _MSVC_FLAGS_CLANG_NO_WARNINGS=-Wno-c++11-narrowing -Wno-register 
 
    when ($_TC_VERSION_EXACTLY_2019 == "yes") { 
        # heretic: на момент коммита в нашей конфигурации указано, что тулчейн clang11-windows - аналог msvc 2019 
        # https://a.yandex-team.ru/arc/trunk/arcadia/build/ya.conf.json?rev=r7910792#L2185 
        # сам clang11 по дефолту представляется msvc2017 (#define _MSC_VER 1911 
        # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/clang11/lib/Driver/ToolChains/MSVC.cpp?rev=r7913127#L1352 
        # вручную заставляем его представляться msvc2019 (#define _MSC_VER 1921) 
        # значение версии взято вот отсюда: 
        # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/llvm11/include/llvm/Support/Compiler.h?blame=true&rev=r7913127#L89 
        _MSVC_FLAGS_CLANG_EQ_2019=-fms-compatibility-version=19.21 
    } 
} 
 
_MSVC_FLAGS=/nologo /Zm500 /GR /bigobj /FC /EHs /errorReport:prompt $MSVC_INLINE_FLAG /utf-8 
# enable standard conforming mode 
_MSVC_FLAGS+=/permissive- 
_MSVC_FLAGS+=$_MSVC_FLAGS_ARCH_OPT 
_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG 
_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_ARCH 
_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_NO_WARNINGS 
_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_EQ_2019 
_MSVC_FLAGS+=$_MSVC_FLAGS_INCLUDE 
 
MSVC_INLINE_OPTIMIZED=yes 
when ($MSVC_INLINE_OPTIMIZED == "yes") { 
    MSVC_INLINE_FLAG=/Zc:inline 
} 
when ($MSVC_INLINE_OPTIMIZED == "no") { 
    MSVC_INLINE_FLAG=/Zc:inline- 
} 
 
# Use builtin offsetof implementation 
# instead of a crutcy macro defined in ucrt/stddef.h. 
# The latter can not be used in constexpr statements. 
_CXX_DEFINES=/D_CRT_USE_BUILTIN_OFFSETOF 
 
_FLAGS_C_ONLY= 
 
# Provide proper __cplusplus value 
# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ 
_CXX_FLAGS=/Zc:__cplusplus 
 
_FLAGS_MSVS_ONLY= 
DEBUG_INFO_FLAGS=/Z7 
when ($IDE_MSVS == "yes") { 
    when ($CLANG_CL != "yes") { 
        _FLAGS_MSVS_ONLY=/FD /MP 
    } 
    DEBUG_INFO_FLAGS=/Zi /FS 
} 
 
C_WARNING_OPTS=$_C_WARNINGS 
CXX_WARNING_OPTS=$_CXX_WARNINGS 
 
# https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx 
when ($DLL_RUNTIME == "yes") { 
    _FLAGS_DEBUG_RUNTIME=/MDd 
    _FLAGS_RELEASE_RUNTIME=/MD 
} 
otherwise { 
    _FLAGS_DEBUG_RUNTIME=/MTd 
    _FLAGS_RELEASE_RUNTIME=/MT 
} 
CFLAGS_DEBUG=/Ob0 /Od /D_DEBUG $_FLAGS_DEBUG_RUNTIME 
CFLAGS_RELEASE=/Ox /Ob2 /Oi /DNDEBUG $_FLAGS_RELEASE_RUNTIME 
 
MASMFLAGS= 
_MASM_IO=/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} 
when ($ARCH_ARMV7) { 
    _MASM_IO=-o ${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} 
} 
 
OBJ_CROSS_SUF=$OBJ_SUF 
OBJECT_SUF=$OBJ_SUF.obj 
 
CFLAGS+=$_MSVC_FLAGS $_FLAGS_MSVS_ONLY $CFLAGS_PER_TYPE $DEBUG_INFO_FLAGS $C_WARNING_OPTS $C_DEFINES $USER_CFLAGS $USER_CFLAGS_GLOBAL 
CXXFLAGS+=$CFLAGS $_STD_CXX $_CXX_FLAGS $_CXX_DEFINES $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL 
CONLYFLAGS+=$_FLAGS_C_ONLY $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL 
 
BC_CFLAGS+=$CFLAGS 
BC_CXXFLAGS+=$BC_CFLAGS $CXXFLAGS 
 
CFLAGS+=$_CFLAGS_UCRT_VC_INCLUDES 
 
when ($NO_WSHADOW == "yes") { 
    C_WARNING_OPTS+=/wd4456 /wd4457 
} 
when ($NO_COMPILER_WARNINGS == "yes") { 
    C_WARNING_OPTS=/w 
    CXX_WARNING_OPTS= 
} 
when ($NO_OPTIMIZE == "yes") { 
    OPTIMIZE=/Od 
} 
 
SFDL_FLAG=/E /C /P /TP /Fi$SFDL_TMP_OUT 
WERROR_FLAG=/WX 
 
CL_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} cl 
ML_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ml 
when ($_UNDER_WINE == "yes") { 
    CL_WRAPPER= 
    ML_WRAPPER= 
} 
 
_SRC_C_NODEPS_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ${CFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} 
_SRC_CPP_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} 
_SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} 
_SRC_M_CMD=$_EMPTY_CMD 
_SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p AS"} ${kv;hide:"pc yellow"}