You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add new cc_preprocess rule for preprocessing arbitrary files #844
P4This is either out of scope or we don't have bandwidth to review a PR. (No assignee)category: core rulestype: feature requestRequest for new, generally useful functionality that is missing
Add a simple cc_preprocess rule that invokes the configured C/C++ compiler's preprocessor on an arbitrary input file.
This would be useful for generating files such as linker scripts, preprocessing Microsoft assembly files, or using the C preprocessor as a lightweight template engine. Using the configured C/C++ toolchain would also avoid having to manually determine the compiler-specific preprocessing flags.
However, an array such as ["HIGHERHALF_ADDRESS=..."] may be simpler, since both MSVC and GNU-compatible compilers use essentially the same syntax for command-line preprocessor definitions.
The rule should handle translating its attributes into the appropriate compiler-specific flags and use the C/C++ toolchain selected for the target.
Having this functionality directly in rules_cc would be useful for projects that need standalone preprocessing and would avoid requiring users to implement or patch a custom preprocessing rule themselves.
I suspect there's a number of home-grown variants of this given its omission from rules_cc. Would definitely be nice to not expect projects to implement a variant of this themselves.
I think so too. I built one for MSVC as mentioned above and it would generally be easier if there was a "builtin" variant. But obviously, other Issues take priority over new features. I fully respect your work
P4This is either out of scope or we don't have bandwidth to review a PR. (No assignee)category: core rulestype: feature requestRequest for new, generally useful functionality that is missing
Activity
backtr4ce commentedon Aug 11, 2026
As a concrete example, this is the custom rule I currently use for the MASM/libffi case mentioned above:
With a generic
cc_preprocessrule, all of this could essentially become:armandomontanez commentedon Aug 14, 2026
I suspect there's a number of home-grown variants of this given its omission from
rules_cc. Would definitely be nice to not expect projects to implement a variant of this themselves.backtr4ce commentedon Aug 14, 2026
I think so too. I built one for MSVC as mentioned above and it would generally be easier if there was a "builtin" variant. But obviously, other Issues take priority over new features. I fully respect your work
backtr4ce commentedon Aug 15, 2026
I don't seem to be able to sign that CLA thingy with my correct Google account but I wrote a patch. I could attach it to this issue.