-
Notifications
You must be signed in to change notification settings - Fork 37
fix compile warning of shadowing a previous local [-Wshadow] #1083
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
Conversation
darshan-runtime/lib/darshan-core.c
Outdated
| #include <lustre/lustre_user.h> | ||
| #endif | ||
|
|
||
| static int __darshan_disabled; |
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.
Would it be better to put the static int __darshan_disabled; statements in darshan.h so that it doesn't have to be explicitly declared in all of the .c files?
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.
I have made changes accordingly.
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.
Well, the side effect of this is a compilation warning on defined but not used variable of __darshan_disabled for the following files.
../../../darshan/darshan-runtime/lib/darshan-config.c:16:
../../../darshan/darshan-runtime/lib/darshan-common.c:22:
../../../darshan/darshan-runtime/lib/darshan-ldms.c:17:
../../../darshan/darshan-runtime/lib/darshan-dxt.c:34:
../../../darshan/darshan-runtime/lib/darshan-heatmap.c:23:
../../../darshan/darshan-runtime/lib/darshan-config.c:16:
../../../darshan/darshan-runtime/lib/darshan-ldms.c:17:
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.
I revert the changes, as not all files including darshan.h make use of
variable __darshan_disabled.
|
Something feels weird to me about this. It is odd for some of the .c files to have to declare Superficially, we could make Looking deeper, I'm trying to figure out what the variable is accomplishing in general. It's value is determined by checking if What do you think? Should we just do the eliminate the |
I feel like I'm missing something about why this is set up this way 🫤 |
|
I do not know much about I do not like my solution in this PR which makes it a locally global variable per file. |
|
The latest commit, ac1809b, makes |
|
Ok, I see what you mean. This iteration is the biggest change since it requires introducing a variable declaration in so many places, but I think you are right that it is the safest option. That way the value won't change in the middle of a wrapper. |
…Wshadow] * make variable __darshan_disabled a locally global in each file referring to it.
* copy the original file darshan-apmpi.c to orig_darshan-apmpi.c so it can be restored when running make clean * store the entire patched darshan-apmpi.c as patched_darshan-apmpi.c instead of patch file. This is because on some system, e.g. Perlmutter, patch command may apply patch files differently
This is to fix the first part of #1077 (compilation warning on shadowed declaration).
Note this PR stacks on top of #1082, because file
darshan-apmpi.cfrom autoperf submodule also needs to be fixed.
This PR needs to be rebased on #1084 to pass CI
end_to_end_regression.yml