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

Fix Checkpatch and Sparse tool warnings #885

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

erhankur
Copy link
Contributor

@erhankur erhankur commented Jul 13, 2023

We have fixed several warnings in our fork. https://github.com/espressif/openocd-esp32

I would like to fix them also here. This will be helpful when/if you want to upstream your commits.

Additionally cherry-picked a commit from upstream to fix build errors on the Clang compiler.

Remaining Sparse warnings:
https://github.com/erhankur/riscv-openocd/actions/runs/5548680099/jobs/10131935209?pr=3#step:5:3064

Most of them can be fixed by adding ULL or LL to 64-bit macros inside encoding.h
I can fix them after getting your opinion.

JanMatCodasip
JanMatCodasip previously approved these changes Jul 14, 2023
Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

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

Thanks!

timsifive
timsifive previously approved these changes Jul 14, 2023
Copy link
Collaborator

@timsifive timsifive left a comment

Choose a reason for hiding this comment

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

I'm not a fan of all this non-functional churn, which will only generate more changes between riscv-openocd and upstream. But I guess it needs to be done, and I assume every change here is because a tool is enforcing that style now.

If it possible to make a github workflow that automatically runs Sparse, similar to how we currently run checkpatch?

@erhankur
Copy link
Contributor Author

I'm not a fan of all this non-functional churn, which will only generate more changes between riscv-openocd and upstream. But I guess it needs to be done, and I assume every change here is because a tool is enforcing that style now.

If it possible to make a github workflow that automatically runs Sparse, similar to how we currently run checkpatch?

Yes possible. The easy way, just need a reference for the current head. It might be a counter or a log file that we can compare.
Another way, not easy, might be comparing git diff lines with the created log file.
We will make it for our fork. Also for the clang scan-build tool. Then I can come up here with another PR

@timsifive
Copy link
Collaborator

Looks like this PR now has a conflict.

@erhankur erhankur dismissed stale reviews from timsifive and JanMatCodasip via eeeac55 July 18, 2023 21:55
@erhankur erhankur force-pushed the fix_tool_warnings branch 3 times, most recently from 1618d03 to a6bb3a6 Compare July 18, 2023 22:05
@erhankur
Copy link
Contributor Author

Looks like this PR now has a conflict.

Rebased and fixed.

src/target/riscv/riscv.c Outdated Show resolved Hide resolved
@erhankur
Copy link
Contributor Author

@timsifive can we merge this?

Below warnings are fixed.

1- A function declaration without a prototype is deprecated in all
versions of C [-Werror,-Wstrict-prototypes]

2- error: variable set but not used [-Werror,-Wunused-but-set-variable]

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1cf14b8e5e3e732ebc9cacc4b1cb9009276a8ea9
Reviewed-on: https://review.openocd.org/c/openocd/+/7569
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Besides checkpatch, now upstream codes are scanning with
Sparse semantic checker tool.
This commit addresses some Sparse and checkpatch warnings.

Change-Id: I0e3e9f15220d8829c5708897af27aa86a8f90c07
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
@timsifive timsifive merged commit 21fd3e1 into riscv-collab:riscv Jul 21, 2023
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.

4 participants