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

compile_commands additional toolchain include paths #1465

Closed
decimad opened this issue Jan 18, 2018 · 6 comments
Closed

compile_commands additional toolchain include paths #1465

decimad opened this issue Jan 18, 2018 · 6 comments

Comments

@decimad
Copy link

decimad commented Jan 18, 2018

Hey,
it seems the extension ignores manually set include/browse paths once you have a compile_commands.json set up to be used. However in my case this file does not include the built-in toolchain include paths. Adding them to includePaths/browse does not seem to be recognized by the extension in this case.
Is the intentention for me to achieve this differently? Would it be possible to add these settings to the set gathered by parsing the compile_commands.json ?

@sean-mcmanus
Copy link
Collaborator

I seem to recall it was a design decision, but @bobbrow probably knows more. We try to query the compiler for the builtin includePaths, but there are cases in which that can be incorrect and the builtin defines are not used yet. We could theoretically change it so that the includePath/defines is appended to the ones obtained from the compile_commands.json. That could break people who rely on the previous behavior, but they should be able to clear out their settings to obtain the previous behavior.

@aakre
Copy link

aakre commented Jan 19, 2018

What you describe seems to be the intended behavior, but according to the documentation you should get a warning if there is no entry for the toolchain include paths:

compileCommands (optional): If "C_Cpp.intelliSenseEngine" is set to "Default" in your settings file, the includes and defines discovered in this file will be used instead of the values set for includePath and defines. If the compile commands datasbase does not contain an entry for the translation unit that corresponds to the file you opened in the editor, then a warning message will appear and the extension will use the includePath and defines settings instead.

@sean-mcmanus
Copy link
Collaborator

@aakre Ah, yeah, I talked to Bob today and he mentioned that "fallback" behavior. I think we decided to add some sort of systemIncludePath/systemDefines setting which corresponds to what the built-in values used by your compiler and that would get appended on, and the existing includePath/defines would keep the same behavior and only be used as a fallback (combined with the system ones too). We were already planning to add separate "system" properties to solve some other issues.

@decimad
Copy link
Author

decimad commented Jan 19, 2018

Hrmm, I'm cross-compiling through cmake (toolchain file), so I'm not very optimistic that the c++ extension will easily be able to determine the compiler automatically to determine the system includes. However it would be equally fine if I just could set the compiler executable manually in this case (if the extension can handle gcc derivates).
The most "conservative" solution imho would be if there was a switch to control wether the manual include paths are taken as system paths in case compile_commands are used.

@sean-mcmanus
Copy link
Collaborator

@decimad 1. We're adding a setting to your compiler path. 2. We'll also query the compiler for defines. I think that would solve your issue.

@sean-mcmanus sean-mcmanus self-assigned this Jan 25, 2018
@bobbrow
Copy link
Member

bobbrow commented Feb 27, 2018

This should be covered by #1293.

@bobbrow bobbrow closed this as completed Feb 27, 2018
@sean-mcmanus sean-mcmanus removed their assignment Apr 22, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants