FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix # 11/ Read include paths from both C and C++ language settings by davidramnero · Pull Request #30 · cppchecksolutions/cppcheclipse · GitHub

fix # 11/ Read include paths from both C and C++ language settings - #30

Merged
davidramnero merged 3 commits into
mainfrom
fix#11/read-include-paths-from-c-and-cpp-language-settings
Aug 4, 2026
Merged

fix # 11/ Read include paths from both C and C++ language settings#30
davidramnero merged 3 commits into
mainfrom
fix#11/read-include-paths-from-c-and-cpp-language-settings

Conversation

davidramnero commented Jul 20, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Addressing: #11

The plugin already scans language settings for includes, but previously it only read in settings for c++ projects, i.e. include paths configured for c projects were ignored. This is now fixed.

*/
protected Collection<File> getIncludes(boolean onlyUserDefined) {
Collection<File> paths = new LinkedList<File>();
Collection<File> paths = new LinkedHashSet<File>();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

to avoid duplicates if same includes are added in both c and c++ language settings

davidramnero requested a review from danmar July 20, 2026 10:34
private final IProject project;
private final IWorkspaceRoot root;
private static final String GCC_LANGUAGE_ID = "org.eclipse.cdt.core.gcc";
private static final String GPP_LANGUAGE_ID = "org.eclipse.cdt.core.g++";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

hmm this does not feel rock solid to me. eclipse can use different compilers, not just gcc/g++. is it specified somewhere that getLanguageId only returns these strings for C/C++ code?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

btw the old code to compare the extension is not rock solid neither.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

good point!

}
for (ICLanguageSetting ls : allLanguageSettings) {
String id = ls.getLanguageId();
if (GCC_LANGUAGE_ID.equals(id) || GPP_LANGUAGE_ID.equals(id)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if the file to analyze is a C file then it would be preferable to not use GPP settings. how doable would that be?

If neither GCC_LANGUAGE_ID nor GPP_LANGUAGE_ID is found but another compiler is used.. an idea could be to load all the include paths from all language settings?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

it's a good idea, I'll see what I can do

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The whole plugin seems to be built around analyzing a whole project in a batch, so it would probably require some serious re-design to achieve this

davidramnero requested a review from danmar August 4, 2026 11:12
davidramnero merged commit 1a841db into main Aug 4, 2026
1 check passed
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL