<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-cl handles /E and /P (preprocess only) with PCH files"
href="https://bugs.llvm.org/show_bug.cgi?id=38508">38508</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-cl handles /E and /P (preprocess only) with PCH files
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>brucedawson@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I tried to generate the preprocessed output of base\win\enum_variant.cc and it
failed with cryptic errors due to an incompatibility with the /Fp and /Yu
options.
>From my out\debug directory I went:
<span class="quote">> ninja -v ..\..\base\win\enum_variant.cc^^</span >
I then took the verbose output of the last compile command, flipped the slashes
to back slashes for the path to clang-cl.exe, removed /showIncludes, and ran
this:
"..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe" /nologo /FC
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\win_sdk\Include\10.0.17134.0\um
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\win_sdk\Include\10.0.17134.0\shared
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\win_sdk\Include\10.0.17134.0\winrt
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\win_sdk\Include\10.0.17134.0\ucrt
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\VC\Tools\MSVC\14.14.26428\include
-imsvc..\..\third_party\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\VC\Tools\MSVC\14.14.26428\atlmfc\include
-DV8_DEPRECATION_WARNINGS -DUSE_AURA=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING
-DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD
-DFIELDTRIAL_TESTING_ENABLED "-DCR_CLANG_REVISION=\"338452-1\""
-D_HAS_NODISCARD -D_HAS_EXCEPTIONS=0 -D__STD_C -D_CRT_RAND_S
-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL
-D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=1 -DWIN32
-D_SECURE_ATL -D_USING_V110_SDK71_ -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE
-DNTDDI_VERSION=0x0A000002 -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_DEBUG
-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1
-DBASE_IMPLEMENTATION -I../.. -Igen /utf-8 /X -Wno-builtin-macro-redefined
-D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics
-fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0
-fdiagnostics-absolute-paths -no-canonical-prefixes -fcomplete-member-pointers
/Gy /FS /bigobj /d2FastFail /Zc:sizedDealloc- -fmsc-version=1911 -m64 /Brepro
/W4 -Wimplicit-fallthrough -Wthread-safety /wd4091 /wd4127 /wd4251 /wd4275
/wd4312 /wd4324 /wd4351 /wd4355 /wd4503 /wd4589 /wd4611 /wd4100 /wd4121 /wd4244
/wd4505 /wd4510 /wd4512 /wd4610 /wd4838 /wd4995 /wd4996 /wd4456 /wd4457 /wd4458
/wd4459 /wd4200 /wd4201 /wd4204 /wd4221 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702
/wd4701 /wd4703 /wd4661 /wd4706 /wd4715 -Wno-missing-field-initializers
-Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default
-Wno-unneeded-internal-declaration -Wno-undefined-var-template
-Wno-nonportable-include-path -Wno-user-defined-warnings
-Wno-unused-lambda-capture -Wno-null-pointer-arithmetic
-Wno-enum-compare-switch -Wno-ignored-pragma-optimize /Od /Ob0 /GF /Z7
-fno-standalone-debug /MTd -Xclang -add-plugin -Xclang find-bad-constructs
-Xclang -plugin-arg-find-bad-constructs -Xclang enforce-in-thirdparty-webkit
-Xclang -plugin-arg-find-bad-constructs -Xclang check-enum-max-value
-Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare
-Wno-char-subscripts -Wglobal-constructors -Wexit-time-destructors
/FIbuild/precompile.h -Wshadow /wd4267 /Fpobj/base/base_cc.pch
/Yubuild/precompile.h -Wno-undefined-bool-conversion
-Wno-tautological-undefined-compare /TP /wd4577 /GR- /c
../../base/win/enum_variant.cc /Foobj/base/base/enum_variant.obj
/Fd"obj/base/base_cc.pdb"
That works fine and generates enum_variant.obj.
Then I added /P and get a huge list of warnings:
clang-cl.exe: warning: argument unused during compilation:
'-mno-incremental-linker-compatible' [-Wunused-command-line-argument]
<built-in>(2,9): warning: definition of macro '__llvm__' does not match
definition in precompiled header [-Wclang-cl-pch]
#define __llvm__ 1
^
<built-in>(3,9): warning: definition of macro '__clang__' does not match
definition in precompiled header [-Wclang-cl-pch]
#define __clang__ 1
^
<built-in>(4,9): warning: definition of macro '__clang_major__' does not match
definition in precompiled header [-Wclang-cl-pch]
#define __clang_major__ 7
^
<built-in>(5,9): warning: definition of macro '__clang_minor__' does not match
definition in precompiled header [-Wclang-cl-pch]
#define __clang_minor__ 0
...
If I delete "/Fpobj/base/base_cc.pch /Yubuild/precompile.h" from the command
then all of the definition warnings go away and a preprocessed file is still
created (the "argument unused" warnings remain but those are less serious).
It seems that clang-cl should ignore the /Fp and /Yu options when doing
preprocessing only, or else give an error message about them being incompatible
with /P and /E.
I don't think this depends on my gn args, but here they are just in case:
is_component_build = false
is_debug = true
target_cpu = "x64"
enable_nacl = false
remove_webcore_debug_symbols = true
treat_warnings_as_errors = false
msvc_use_absolute_paths = true</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>