Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-processed header support. #209

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

helly25
Copy link

@helly25 helly25 commented Aug 18, 2024

This is a expanded version of #205

It adds more header file extensions.

This fixes: #199

This is a expanded version of hedronvision#205

It adds more header file extensions.
@mikael-s-persson
Copy link

I just tried to use this patch, and it failed on one of my dependencies (mcap library) that has some .inl headers. That is a fairly common header('ish) extension too.

I'd suggest adding .inl to the list, I guess to the C list.

@helly25
Copy link
Author

helly25 commented Aug 27, 2024

I just tried to use this patch, and it failed on one of my dependencies (mcap library) that has some .inl headers. That is a fairly common header('ish) extension too.

I'd suggest adding .inl to the list, I guess to the C list.

I have added '.inl' as possible c source. However, there is an issue with those as they are typically not meant as stand alone sources. Nonetheless, the tool should just gracefully warn on failure.

Imo it would be better to provide good defaults an customization, so the '.inl' could be optional. One way to allow customization is https://github.com/helly25/bazel-compile-commands-extractor/tree/custom-control-args another would be to use actual config files.

There is an issue with those as they are typically not meant as stand alone sources.
Nonetheless, the tool should just gracefully warn on failure.
@helly25 helly25 force-pushed the feat/pre_processed_header_support_20240818 branch from 4396d37 to 4f5eea2 Compare August 27, 2024 05:53
@mikael-s-persson
Copy link

I've noticed a couple of remaining issues with this. Example of a short excerpt of output:

....
clang: error: no such file or directory: 'bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/abseil-cpp~/absl/container/_objs/flat_hash_map/flat_hash_map.h.processed'
clang: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument]
clang: error: no such file or directory: 'bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/abseil-cpp~/absl/time/_objs/time/civil_time.h.processed'
clang: error: no such file or directory: 'bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/abseil-cpp~/absl/time/_objs/time/clock.h.processed'
clang: error: no such file or directory: 'bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/abseil-cpp~/absl/time/_objs/time/time.h.processed'
clang: error: no such file or directory: 'bazel-out/k8-dbg/bin/external/abseil-cpp~/absl/container/_objs/flat_hash_map/flat_hash_map.h.processed'
....

The first issue is that the "-fsyntax-only" argument should be filtered out of the compilation arguments. I'm not familiar enough to know where exactly to do that but it seems like that should be trivial. This issue is not making it fail, but just creates a lot of noise in the output.

The second issue appears to me to be some sort of a race-condition on the ".processed" files. When re-running the generation again, the problem goes away, i.e., maybe the dependency on those output files is not getting properly registered/declared so that a more-or-less fresh run causes commands that expect those files to exist to be run before those files have been generated / sym-linked. Again, I don't know exactly how to fix that.

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.

No source files found in compile args error
2 participants