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

Indexing source files when multiple toolchains are used. #157

Merged

Conversation

ewaterlander
Copy link
Contributor

This change solves the indexing of C/C++ files when multiple toolchains are used in a single Makefile. This is for the use case in which one (Linux) gcc compiler plus one or more custom embedded C compilers (all producing ELF format binaries) are used.

To get proper indexing we need to know for each resource which toolchain was used. The sub build configuration (via extension point org.eclipse.cdt.core.buildConfigProvider) extends
StandardBuildConfiguration.java, and overrides method IToolChain (List commandgetToolChain). tcMap is filled with a map of toolchains per resource. The primary toolchain keeps pointing to the gcc toolchain.

@github-actions
Copy link

github-actions bot commented Nov 10, 2022

Test Results

   541 files     541 suites   17m 14s ⏱️
9 624 tests 9 602 ✔️ 22 💤 0
9 646 runs  9 624 ✔️ 22 💤 0

Results for commit a28dfce.

♻️ This comment has been updated with latest results.

@ewaterlander
Copy link
Contributor Author

About the code cleanliness check: I ran the standard Source > Format menu on the code, using the Eclipse built-in formatter profile.

@cmorty
Copy link
Contributor

cmorty commented Nov 11, 2022

@ewaterlander : You need to run ./releng/scripts/check_code_cleanliness.sh locally. Otherwise fixing them is a PITA!

@jonahgraham
Copy link
Member

The JDT's Save Actions should have generated the correct format for the code. However over time as JDT bugs are fixed we need to update the JDT on the build machine to make sure they match as there are slight formatting changes.

Also, some refactorings skip the save actions, if that refactoring changes the length of an identifier it leaves badly formatted code behind.

I am more than happy to accept improvements in this area. One idea that I had was to simply commit the change back to the PR rather than fail the code cleanliness check. This is easier now that we are on GitHub.

@jonahgraham
Copy link
Member

About the code cleanliness check: I ran the standard Source > Format menu on the code, using the Eclipse built-in formatter profile.

PS - the CDT project does not use the built-in formatter profile, there is a CDT profile. But on closer inspection I see that there is also trailing whitespace on some lines. The save actions are supposed to clean that up, but sometimes they don't as there seems to be a conflict between JDT removing trailing spaces and the formatter adding trailing spaces in javadoc comments.

@jonahgraham
Copy link
Member

Anyway, don't worry about the formatting, I can fix that up before merge this time once I complete the rest of the review.

Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

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

I need more time to mull this over. It is much better than the #130 as you have solved the problem of leaving things in a bad state, so I am inclined to merge it. Leave it with me for a day or two.

@jonahgraham
Copy link
Member

I cannot push my formatting updated because (I think) you have disabled "Allow edits and access to secrets by maintainers" - which is fine as there are security considerations around it - but it means you'll have to do the formatting fix before I can merge.

The checkbox is on the right side column:
image

This change solves the indexing of C/C++ files when multiple
toolchains are used in a single Makefile. This is for the use case in
which one (Linux) gcc compiler plus one or more custom embedded C
compilers (all producing ELF format binaries) are used.

To get proper indexing we need to know for each resource which
toolchain was used. The sub build configuration (via extension point
org.eclipse.cdt.core.buildConfigProvider) extends
StandardBuildConfiguration.java, and overrides method IToolChain
(List<String> commandgetToolChain). tcMap is filled with a map of
toolchains per resource. The primary toolchain keeps pointing to the
gcc toolchain.
@ewaterlander
Copy link
Contributor Author

@ewaterlander : You need to run ./releng/scripts/check_code_cleanliness.sh locally. Otherwise fixing them is a PITA!
Thanks!

@ewaterlander
Copy link
Contributor Author

I cannot push my formatting updated because (I think) you have disabled "Allow edits and access to secrets by maintainers" - which is fine as there are security considerations around it - but it means you'll have to do the formatting fix before I can merge.

The checkbox is on the right side column: image

Indeed, I did not check that box. I have fixed the formatting now.

@cmorty
Copy link
Contributor

cmorty commented Nov 14, 2022

OT:

One idea that I had was to simply commit the change back to the PR rather than fail the code cleanliness check. This is easier now that we are on GitHub.

This is ugly stuff. Especially as you probably want to run it using git filter-branch to actually fix the right patch.

@ewaterlander
Copy link
Contributor Author

I cannot push my formatting updated because (I think) you have disabled "Allow edits and access to secrets by maintainers" - which is fine as there are security considerations around it - but it means you'll have to do the formatting fix before I can merge.
The checkbox is on the right side column: image

Indeed, I did not check that box. I have fixed the formatting now.

I also allow maintainers edits now.

@jonahgraham
Copy link
Member

OT:

One idea that I had was to simply commit the change back to the PR rather than fail the code cleanliness check. This is easier now that we are on GitHub.

This is ugly stuff. Especially as you probably want to run it using git filter-branch to actually fix the right patch.

No, my plan would be to add a new commit automatically, in the same way I would have done manually if "Allow edits..." was enabled. Let's continue this discussion in #166

jonahgraham
jonahgraham previously approved these changes Nov 14, 2022
Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

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

I need more time to mull this over. It is much better than the #130 as you have solved the problem of leaving things in a bad state, so I am inclined to merge it. Leave it with me for a day or two.

Approved. I am still a little unsure about this, but it does address your use case and it doesn't have the problems I was concerned about in #130. So once build gives it +1 I can merge this.

@ewaterlander
Copy link
Contributor Author

Do not merge it yet.
I see a hang if the example code generation is on when the project is created.

@ewaterlander
Copy link
Contributor Author

Do not merge it yet. I see a hang if the example code generation is on when the project is created.

The hang was not caused by my patch. I had it too in the unmodified version. After rebuilding my stuff I did not see it anymore.

@ewaterlander
Copy link
Contributor Author

Do not merge it yet. I see a hang if the example code generation is on when the project is created.

The hang was not caused by my patch. I had it too in the unmodified version. After rebuilding my stuff I did not see it anymore.

This change can be merged.

@jonahgraham
Copy link
Member

I had it too in the unmodified version

If you are able to, please provide a bug report on this. Ideally including the output of jstack which will hopefully show any deadlocks

@jonahgraham jonahgraham merged commit 8c9faa1 into eclipse-cdt:main Nov 16, 2022
@ewaterlander
Copy link
Contributor Author

I had it too in the unmodified version

If you are able to, please provide a bug report on this. Ideally including the output of jstack which will hopefully show any deadlocks

OK, I will. I do not have experience with jstack. Do you have some hints?

@jonahgraham
Copy link
Member

jstack should be included with your JDK, it is a command line program that you pass the PID to to get the stack traces of all running threads, and it is able to detect some kinds of deadlocks.

@ewaterlander ewaterlander deleted the core_build_make_toolchains branch November 21, 2022 13:42
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.

None yet

3 participants