-
Notifications
You must be signed in to change notification settings - Fork 931
Fix a bunch of compiler warnings in "make check" #8845
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
base: main
Are you sure you want to change the base?
Conversation
5212395 to
0e76227
Compare
|
IBM CI had a bad weekend (sorry about that). We should be all good now. |
test/datatype/reduce_local.c
Outdated
| { NULL, "MPI_OP_NULL", MPI_OP_NULL } | ||
| }; | ||
| static int do_ops[12] = { -1, }; /* index of the ops to do. Size +1 larger than the array_of_ops */ | ||
| static int global_do_ops[12] = { -1, }; /* index of the ops to do. Size +1 larger than the array_of_ops */ |
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 doubt it is necessary, the shadowing is done in purpose.
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 shadowing creates a bunch of warnings, such as:
1122 reduce_local.c: In function ‘build_do_ops’:
1123 reduce_local.c:84:34: warning: declaration of ‘do_ops’ shadows a global decla\
ration [-Wshadow]
1124 build_do_ops( char* optarg, int* do_ops)
1125 ~~~~~^~~~~~
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 understand what the warning is but I said I do this on purpose. By default all functions use the global variable until I need to specialize their behavior, in which case I add a param shadowing the global variable.
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'm not a huge fan of that paradigm, as I think it's pretty easy for developers to miss and or get wrong. I certainly wouldn't want any of the developers in my org to write code like that. That said, if we are going to intentionally shadow variables, can we at least document that we're doing so intentionally? I still think it is bad form, and that we should not remove the general compiler warning, so we'll have to figure out how to ignore the warning in this file), but we at least need to tell people it was intentional.
test/datatype/unpack_ooo.c
Outdated
| } | ||
| for (i = 0; 0 != arr[i][0]; i++) { | ||
| if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i][0])) ) { | ||
| if( (displ >= (ptrdiff_t) arr[i][1]) && |
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.
displ is a ptrdiff_t already because of a compiler complaint, (because it is computed as a difference between two pointers, while in fact is the displacement of a field in a struct).
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.
Here's the compiler warnings it generated without updating the RHS to be (ptrdiff_t):
1024 unpack_ooo.c: In function ‘testcase’:
1025 unpack_ooo.c:154:32: warning: comparison of integer expressions of different \
signedness: ‘ptrdiff_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int\
’} [-Wsign-compare]
1026 if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i\
][0])) ) {
1027 ^~
1028 unpack_ooo.c:154:56: warning: comparison of integer expressions of different \
signedness: ‘ptrdiff_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int\
’} [-Wsign-compare]
1029 if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i\
][0])) ) {
1030 ^~
I don't have an opinion on this one; do you prefer a different fix?
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.
Based on a machine understanding of a piece of code. I don't really care.
0e76227 to
a2b3fa8
Compare
|
@jsquyres Can you please rebase? This may be important. |
a2b3fa8 to
c2c0e2d
Compare
|
bot:retest |
|
bot:ibm:retest |
|
Any reason to hold this PR any longer? (other than it need to be rebased) |
c2c0e2d to
8f69c08
Compare
|
I rebased on tip of |
|
If that 3rd commit passes CI properly, you'll squash it appropriately, right? (minor pet peeve: make a commit on a PR and then make a later commit on the same PR to fix the earlier commit) |
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.
What's the warning? The non-sized version is supposed to handle multiple sizes without warning, so if we're emitting warnings here, that's an issue we shouldn't gloss over with this particular patch.
|
mellanox CI failed that it couldn't find a definition for the non-sized versions of these, and I searched around and couldn't find those definitions either, so I created the 3rd commit. |
|
I git bisected |
|
bot:aws:retest |
There were many compiler warnings, making it difficult to read if there were real issues that needed to be addressed. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Trivial updates to make all the output appear on stderr (vs. just some of it on stderr and other parts of it on stdout). Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Fixing 6 calls that I may have incorrectly addressed in the previous commit when I rebased to latest main. Signed-off-by: Geoffrey Paulsen <gpaulsen@us.ibm.com>
2f6c7a6 to
f76b68a
Compare
There were many compiler warnings, making it difficult to read if
there were real issues that needed to be addressed.
Signed-off-by: Jeff Squyres jsquyres@cisco.com