Skip to content

do not pass -c to preprocessor in build_cache - #7867

Open
damster101 wants to merge 1 commit into
xmake-io:devfrom
damster101:patch10
Open

damster101 wants to merge 1 commit into
xmake-io:devfrom
damster101:patch10

Conversation

@damster101

Copy link
Copy Markdown
Contributor

No description provided.

@waruqi

waruqi commented Oct 20, 2026

Copy link
Copy Markdown
Member

Why? It doesn't seem to have any impact; besides, the build cache for cl is currently disabled by default.

@damster101

Copy link
Copy Markdown
Contributor Author

Why? It doesn't seem to have any impact; besides, the build cache for cl is currently disabled by default.

When targeting wasm I got this warning on every compilation:

clang: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]

The emcc toolchain inherits from gcc.lua, so unlike native Clang, it does not inject -Qunused-arguments.
Since emcc uses Clang, _preprocess passes -c alongside -E, and without -Qunused-arguments, triggering the false warning, which is then captured by build_cache and reprinted on every compilation.

Filtering out -c when adding -E in _preprocess prevents the preprocessor from receiving the unused compile flag.

I changed cl.lua as well because clang-cl inherits from it... but since MSVC cl build cache is disabled by default, it indeed doesn't do anything. I'm completely fine with removing that change.

@waruqi

waruqi commented Oct 21, 2026

Copy link
Copy Markdown
Member

Why? It doesn't seem to have any impact; besides, the build cache for cl is currently disabled by default.

When targeting wasm I got this warning on every compilation:

clang: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]

The emcc toolchain inherits from gcc.lua, so unlike native Clang, it does not inject -Qunused-arguments. Since emcc uses Clang, _preprocess passes -c alongside -E, and without -Qunused-arguments, triggering the false warning, which is then captured by build_cache and reprinted on every compilation.

Filtering out -c when adding -E in _preprocess prevents the preprocessor from receiving the unused compile flag.

I changed cl.lua as well because clang-cl inherits from it... but since MSVC cl build cache is disabled by default, it indeed doesn't do anything. I'm completely fine with removing that change.

if emcc use clang, you can modify emcc.lua to inherit clang.


-- get preprocessor flags
table.insert(cppflags, flag)
if flag ~= "-c" then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now emcc has inherited clang, I think we need not add this patch. -Qunused-arguments flag has been added.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants