[llvm-bugs] [Bug 38508] New: clang-cl handles /E and /P (preprocess only) with PCH files

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 9 15:05:09 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38508

            Bug ID: 38508
           Summary: clang-cl handles /E and /P (preprocess only) with PCH
                    files
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brucedawson at chromium.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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:

> ninja -v ..\..\base\win\enum_variant.cc^^

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180809/45fe9bb3/attachment-0001.html>


More information about the llvm-bugs mailing list