MFC icon indicating copy to clipboard operation
MFC copied to clipboard

Dead code

Open sbryngelson opened this issue 3 years ago • 1 comments

Dead code needs to me removed. We seem to have thousands of lines of it. Here is one example: https://github.com/MFlowCode/MFC/blob/fc40ccea496abd8e3b81a543c6b5ba80af589dfb/src/simulation_code/m_rhs.f90#L358-L544

We also have two entire RHS functions: https://github.com/MFlowCode/MFC/blob/fc40ccea496abd8e3b81a543c6b5ba80af589dfb/src/simulation_code/m_rhs.f90#L2928

https://github.com/MFlowCode/MFC/blob/fc40ccea496abd8e3b81a543c6b5ba80af589dfb/src/simulation_code/m_rhs.f90#L1010

The unused one needs to be deleted.

I'd like to see a PR that deletes thousands of lines of unused code.

sbryngelson avatar Sep 21 '22 23:09 sbryngelson

Still more dead code! But going in the right direction.

sbryngelson avatar Sep 27 '22 19:09 sbryngelson

Not sure if this is dead code, but src/simulation/m_variables_conversion and m_riemann_solvers has a subroutine s_compute_average_state and several variables like rho_avg_sf and vel_avg that are never used. Should I get rid of them?

anshgupta1234 avatar Nov 24 '22 16:11 anshgupta1234

Possibly. Can you go back in the git history (perhaps looking at MFC-develop repo as well) and see when they were used? I assume, at some point, they were.

sbryngelson avatar Nov 24 '22 17:11 sbryngelson

Note on this issue: VSCode seems to be pretty good at finding variables that are declared multiple times (once globally and again locally) and finding unused variables. You will need the appropriate fypp extension for VSCode to do this for .fpp files, I think it is here.

At the same time, we should be a bit careful. It will likely throw spurious unused warnings due to not recognizing preprocessing directives like #ifdef from C preprocessor statements.

sbryngelson avatar Nov 27 '22 16:11 sbryngelson

@anandrdbz remove _flat names in variables.

sbryngelson avatar Nov 28 '22 20:11 sbryngelson