-
Notifications
You must be signed in to change notification settings - Fork 66
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 variables #112
Conversation
Codecov Report
@@ Coverage Diff @@
## dev/gfdl #112 +/- ##
=========================================
Coverage 28.76% 28.77%
=========================================
Files 248 248
Lines 72976 72954 -22
=========================================
- Hits 20995 20991 -4
+ Misses 51981 51963 -18
Continue to review full report at Codecov.
|
src/ALE/regrid_edge_values.F90
Outdated
@@ -240,7 +239,7 @@ subroutine edge_values_explicit_h4( N, h, u, edge_val, h_neglect, answers_2018 ) | |||
real, dimension(4) :: dz ! A temporary array of limited layer thicknesses [H] | |||
real, dimension(4) :: u_tmp ! A temporary array of cell average properties [A] | |||
real, parameter :: C1_12 = 1.0 / 12.0 | |||
real :: dx, xavg ! Differences and averages of successive values of x [H] | |||
real :: dx ! Differences and averages of successive values of x [H] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on this line and below at lines 408 and 715 are now inconsistent with the declaration of a single variable.
integer :: k, k_bot_min, k_top_max !< k-indices, min and max for bottom and top, respectively | ||
integer :: k_bot_max, k_top_min !< k-indices, max and min for bottom and top, respectively | ||
integer :: k_bot_diff, k_top_diff !< different between left and right k-indices for bottom and top, respectively | ||
integer :: k, k_bot_min !< k-indices, min and max for bottom and top, respectively |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k_top_max, k_top_min, and k_top_diff are in commented out code, and are reasonably described in the comments. Even though they are not used yet, perhaps they should be retained in comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for eliminating the large number of unused variables in the MOM6 code. I have examined all of these changes, and I think that this will be ready to go as soon as 3 minor comments (listed separately) have been addressed.
This patch removes any unused variables detected by -Wunused-variables in GCC. This may include variables which are referenced in commented "zombie code". In some cases, the variables were preserved in comments, but not in all cases. If the zombie code is restored, it should be possible to reconstruct the original declaration. (All known cases were simple scalars, such as loop indices). In one case, a variable was conditionally used within a preprocessor `#ifdef __DO_SAFETY_CHECKS__` block. This patch moves the declaration into another `#ifdef` block, but perhaps it is preferable to remove the block. Certain documentation variables such as `mdl`, which typically contain the function name, have been removed if unused. The strongest motivation for this patch is to allow us to enable the `-Wall` flag, which includes unused variables, and will strengthen our ability to detect potential errors in the codebase.
I've made the changes recommended by @Hallberg-NOAA, and have also re-added the variable used by @ashao. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for eliminating all of these unused variables and moving around the content in comments as appropriate.
This PR should be accepted and merged in as soon as it passes the pipeline testing.
This PR passed the pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/jobs/77063, but with some irregularities in the units of a variable in the available_diags file stemming from another PR that was accepted earlier today. I am accepting this PR, but will look into that other issue. |
This patch removes any unused variables detected by -Wunused-variables
in GCC.
This may include variables which are referenced in commented "zombie
code". In some cases, the variables were preserved in comments, but no
in all cases. If the zombie code is restored, it should be possible to
reconstruct the original declaration. (All known cases were simple
scalars, such as loop indices).
In one case, a variable was conditionally used within a preprocessor
#ifdef __DO_SAFETY_CHECKS__
block. This patch moves the declarationinto another
#ifdef
block, but perhaps it is preferable to remove theblock.
Certain documentation variables such as
mdl
, which typically containthe function name, have been removed if unused.
The strongest motivation for this patch is to allow us to enable the
-Wall
flag, which includes unused variables, and will strengthen ourability to detect potential errors in the codebase.