-
Notifications
You must be signed in to change notification settings - Fork 263
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
Remove unused code #972
Remove unused code #972
Conversation
75255d1
to
ad47730
Compare
Nice feature! I like that it can see unused code in several steps. That one line will be unused once you remove another unused line. I'm thinking such a check should be part of our lint job. |
After the merge I had had a look at what dead code VHDL LS did not find: check.vhd:77 |
Are you basing you conclusion on the contents of this MR? This MR does not remove all dead code within VUnit that VHDL-LS finds. For example it also finds check.vhd:77 that I have not included as part of this MR. Also regarding check.vhd:21 it is the Note that the VHDL-LS unused declaration detection only warns for things that are locally unused. Since VHDL does not have a public/private concept it does not assume that things in a package header are unused as it could be intended to be used by a third party. Adding support for globally unused things would require some sideband configuration of what should be considered private and public which I have not implemented. I still think the locally unused stuff is the most important and most likely to find bugs. An unused signal, port, variable of function argument is much more likely to be a bug than an unused function in a package. |
I did. I noticed one dead code line and then I created a report from another tool. I didn't check the code in that report but the line I noticed was this |
Yes buf on that line is unused code. But it cannot be removed since allocate has a side effect. |
You're right and the comment in the other tool is that the I still haven't looked at all of them but these lines look correctly reported: $ git grep -ni null_storage
vunit/vhdl/data_types/src/integer_vector_ptr_pkg-body-2002p.vhd:59: constant null_storage : storage_t := (integer'low, internal, integer'low);
vunit/vhdl/data_types/src/integer_vector_ptr_pkg-body-93.vhd:13: constant null_storage : storage_t := (integer'low, internal, integer'low);
vunit/vhdl/data_types/src/string_ptr_pkg-body-2002p.vhd:62: constant null_storage : storage_t := (integer'low, internal, integer'low);
vunit/vhdl/data_types/src/string_ptr_pkg-body-93.vhd:13: constant null_storage : storage_t := (integer'low, internal, integer'low); |
Those lines are found by VHDL LS as well. |
See #997. |
This removes a bunch of dead code that I found when developing unused code detection into VHDL LS.