Repository navigation
Conversation
Module codegen actions compile a precompiled module into an object file and never preprocess. Bazel's legacy include_paths, includes and preprocessor_defines features accordingly don't cover the cpp_module_codegen action, but their rules-based counterparts apply to source_compile_actions, which does, so every module codegen action receives the include paths and defines of compile actions. Clang warns about each include path as an unused argument: clang++: warning: argument unused during compilation: '-iquote .' [-Wunused-command-line-argument] Exclude the action from source_compile_actions like lto_backend, which also restores parity with the legacy features. Verified with a rules-based toolchain that supports header modules: module codegen actions no longer get include paths and defines, build without warnings and the resulting objects link and run as before.
lilygorsheneva
approved these changes
Sep 21, 2026
keith
approved these changes
Sep 21, 2026
AustinSchuh
added a commit
to AustinSchuh/rules_cc
that referenced
this pull request
Oct 30, 2026
The merge left random_seed_unix_test unterminated, mangled the compiler_input_flags and compiler_output_flags tests, and put a load out of order. Restore both sides' tests. Main also excluded cpp_module_codegen from the preprocessing action set (bazelbuild#897), so drop it from the includes, include_paths and preprocessor_defines goldens. Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Module codegen actions compile a precompiled module into an object file and never preprocess. Bazel's legacy
include_paths,includesandpreprocessor_definesfeatures accordingly don't cover thecpp_module_codegenaction, but their rules-based counterparts (//cc/toolchains/args/include_flagsand//cc/toolchains/args/preprocessor_defines, as well as the corresponding variables) apply tosource_compile_actions, which does. Every module codegen action thus receives the include paths and defines of compile actions, and Clang warns about each include path as an unused argument (clang++: warning: argument unused during compilation: '-iquote .' [-Wunused-command-line-argument]).This excludes the action from
source_compile_actionslikelto_backendalready is, which restores parity with the legacy features.