Precompiled header handling for zig cc
is half-broken
#22216
Labels
Milestone
zig cc
is half-broken
#22216
This:
zig/src/main.zig
Lines 2654 to 2657 in d48611b
is not the right way to handle PCHs.
When you type
gcc a.c b.h c.h
, you geta.out
(froma.c
),b.h.gch
, andc.h.gch
.For Zig, if you type
zig cc a.c -x c-header b.h -x c-header c.h
, you geta.c.pch
,b.h.pch
, andc.h.pch
! Omitting the-x c-header
makeszig cc
think you want to link the resulting PCH files and fails as you'd expect.In other words, the
-x
should not be necessary; PCH handling should come into effect simply when header files are passed to the compiler. Additionally, compiling PCHs should not preclude compiling a normal binary.Rather than have PCH handling impact the main compiler mode, I think PCH compilation should be handled as a 'secondary task' similar to the dependency file:
zig/src/Compilation.zig
Lines 5697 to 5699 in d48611b
cc @xxxbxxx (#18600)
The text was updated successfully, but these errors were encountered: