Fix clang warnings and cross-platform toolchain failures#276
Open
srikantharun wants to merge 1 commit intohedronvision:mainfrom
Open
Fix clang warnings and cross-platform toolchain failures#276srikantharun wants to merge 1 commit intohedronvision:mainfrom
srikantharun wants to merge 1 commit intohedronvision:mainfrom
Conversation
This commit fixes two issues: 1. Clang warnings about unused -c flag (fixes hedronvision#273) - Strip -c flag from header dependency generation commands - The -c flag is unused during -M (dependency generation) mode and causes "argument unused" warnings with clang -Werror 2. Cross-platform toolchain failure (fixes hedronvision#255) - Add "manual" tag to refresh_compile_commands targets - Prevents failure when running `bazel build //...` for a different target platform that lacks a matching C++ toolchain - These targets are meant for `bazel run`, not regular builds
|
@cpsauer: are you still maintaining the repo? |
swgr424
reviewed
Apr 18, 2026
| # Strip -c flag which is unused during dependency generation (-M) and causes | ||
| # "argument unused during compilation" warnings with clang -Werror. | ||
| # See https://github.com/hedronvision/bazel-compile-commands-extractor/issues/273 | ||
| header_cmd = (arg for arg in header_cmd if arg != '-c') |
There was a problem hiding this comment.
Suggestion: also strip '/c' (similar situation in windows).
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.
Summary
This PR fixes two issues that affect users of LLVM/Clang toolchains with Bazel.
1. Clang warnings about unused
-cflag (fixes #273)Problem: When generating header dependencies, the
-cflag is passed to clang but is unused during-Mmode, causing warnings:Solution: Strip
-cfrom the header dependency generation command, similar to how-oand.oare already stripped.2. Cross-platform toolchain failure (fixes #255)
Problem: When building
//...for a target platform different from the host, therefresh_compile_commandstarget fails:Solution: Add
"manual"tag torefresh_compile_commandstargets. This prevents them from being built withbazel build //...while still allowingbazel runto work correctly.Test plan
-cis stripped from header commandmanualtag is added to py_binarytoolchains_llvmand-Werrorto confirm no warnings--platforms=...to confirm no failure