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

citnames: allow pre/postfixes to cc & c++ compiler calls #602

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

jan-krieg
Copy link
Contributor

This pull request modifies the regex for recognized GCC compiler calls to allow pre/postfixes to cc and c++ in the same manner as already implemented e.g. for gcc (though explicitly excluding cc1, which otherwise would also be matched). This matches e.g. the previously missing x86_64-pc-linux-gnu-cc and x86_64-pc-linux-gnu-c++ compiler calls that are present on my system (Gentoo, sys-devel/gcc-13.2.1_p20240210).

More specifically, I've encountered the issue of such compiler call being unrecognized when applying Bear to the compilation of Neomutt and using the .configure command as used by portage for the Neomutt ebuild (to align with target build process), which then employs x86_64-pc-linux-gnu-cc as compiler call. While this is simply a symlink to x86_64-pc-linux-gnu-gcc (which is recognized by Bear) and the alternative solution would of course be to modify the employed .configure command so that make uses a "different" (but actually identical) compiler call, it would make sense to me if Bear simply recognizes such compiler calls as well (not having used Bear before, it took me a bit to figure out why the generated compile_commands.json was almost empty).

@rizsotto
Copy link
Owner

Thanks @jan-krieg , this looks good.

Could you add unit test for the new compilers? source/citnames/test/ToolGccTest.cc file already has tests in place, just add those new compilers you want to be recognized.

Thanks for your contribution!

Specifically excludes `cc1` which would otherwise be matched as `cc` + postfix.
@jan-krieg
Copy link
Contributor Author

Hi @rizsotto, thanks for the quick feedback! I've extended the existing unit tests to add the two relevant compiler calls (incl. a negative check for cc1). Also did a few local builds with tests enabled to check that they work as expected. Let me know in case any other changes are desired.

@rizsotto rizsotto merged commit 612df90 into rizsotto:master Oct 15, 2024
17 checks passed
@rizsotto
Copy link
Owner

Thanks @jan-krieg for raising this PR.

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