-
-
Notifications
You must be signed in to change notification settings - Fork 244
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
Modified gcc/clang warning suppression macros to account for some warnings flags being supported by one compiler but not the other #379
Conversation
@qkoziol I managed to fix a few const warnings... but anything more I think needs someone that knows the codebase well. |
It looks like you are changing a public API here, Maybe some of the Thanks for looking at these |
Definitely agreed on this point. The op_data pointer is meant to be non-const and there are several tests (currently external to HDF5) that rely on this behavior. For example, consider the case of passing a local variable for op_data that is used to count the number of links that have been iterated over. While it might eliminate the const warnings from HDF5, this would simply push the const warning down to those tests instead. |
The op_data must remain non-const (as @gnuoyd and @jhendersonHDF mention), so the problem is in the caller, not the iterator routines themselves. @gnuoyd's solution of creating a trivial wrapping container is a reasonable way to address it up there. |
55f9a53
to
0d6f392
Compare
OK, I gave up on solving any of those warnings. Instead, I at least fixed the suppression of a few of them with clang. See new commit. |
src/H5public.h
Outdated
#define H5_GCC_CLANG_DIAG_OFF(x) | ||
#define H5_GCC_CLANG_DIAG_ON(x) | ||
#endif | ||
|
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.
These macros are starting to get ugly
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.
Yes, but having hundreds of warnings about trying to suppress non-existent warnings is even uglier IMHO.
Hi Sean, I've given this some thought, and I don't think that adding things like H5_GCC_CLANG_DIAG_OFF is the way to go. I have a more generic solution in mind that will also work for platforms like Visual Studio. Let's leave this up, though, while I put that together. |
Fixing the warnings instead of suppressing them is another nice option :) |
@derobins any word on your alternative? It would be nice to have something, or merge this, because building with clang currently has many warnings about 'unknown pragmas' every time a gcc warning flag that clang doesn't know is disabled with the existing pragmas. |
e30ca57
to
ec9cf3c
Compare
H5_GCC_DIAG_ON remains gcc-only. Added a new H5_CLANG_DIAG_ON that's clang-only, but it's not used anywhere currently. Added a new H5_GCC_CLANG_DIAG_ON that works with both compilers, which afterall support mostly the same warnings. Changed almost all uses of H5_GCC_DIAG_ON to use H5_GCC_CLANG_DIAG_ON, with the exception of a couple, where they really were suppressing gcc-only warnings.
d2c1779
to
444ef05
Compare
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.
This looks like a step in the right direction.
So that's 2 approvals if I'm not mistaken... anything else needed to get this merged? |
Thanks! |
Added const where possible, then removed casts.