-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
OESS-168: Remove clang warnings. #1129
Conversation
@@ -210,7 +210,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ | |||
\ | |||
ARR = (TYPE **)HDmalloc(h5taa_pointers_size + h5taa_data_size); \ | |||
\ | |||
ARR[0] = (TYPE *)(ARR + (DIMS_I)); \ | |||
ARR[0] = (void *)(ARR + (DIMS_I)); \ |
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 is a place where the warning is easy to suppress but the alignment may still be wrong.
I believe DIMS_I
and DIMS_J
are constant. If so, then you can malloc a struct { TYPE *rows[DIMS_I]; TYPE values[DIMS_I * DIMS_J]; } *prototype;
, initialize all DIMS_I
pointers in rows
, and then set ARR
to &prototype->rows[0]
.
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.
As in #1130, I agree with Dave. Casting to a void pointer to make the compiler quiet is probably not the best fix here.
…OLS]; }`. This avoids the double-indirection through pointers and the additional memory of H5TEST_ALLOCATE_2D_ARRAY(). This change will safely quiet the cast warning that PR #1129 was intended to fix.
* Create 2D arrays on the heap by malloc'ing `struct { TYPE arr[ROWS][COLS]; }`. This avoids the double-indirection through pointers and the additional memory of H5TEST_ALLOCATE_2D_ARRAY(). This change will safely quiet the cast warning that PR #1129 was intended to fix. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
I believe #1169 fixed this? |
Fixed by #1169 |
This will fix the following warning:
h5dumpgentest.c:10258:5: warning: cast from 'long double **' to 'long double *' increases required alignment from 8 to 16 [-Wcast-align]