-
Notifications
You must be signed in to change notification settings - Fork 9
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
Avoid discarding const. #7
base: main
Are you sure you want to change the base?
Conversation
The compiler cannot know the allocation is aligned to uint16_t and this avoids a cast alignment warning emitted by clang.
Regarding - table->metadata = (uint16_t *)( (unsigned char *)allocation + VT_CAT( NAME, _metadata_offset )( table ) );
+ table->metadata = (void *)( (unsigned char *)allocation + VT_CAT( NAME, _metadata_offset )( table ) ); and - new_table.metadata = (uint16_t *)( (unsigned char *)allocation + VT_CAT( NAME, _metadata_offset )( &new_table ) );
+ new_table.metadata = (void *)( (unsigned char *)allocation + VT_CAT( NAME, _metadata_offset )( &new_table ) ); was Clang-Tidy complaining about this cast for some reason? The And regarding - static const uint16_t vt_empty_placeholder_metadatum = VT_EMPTY;
+ static uint16_t vt_empty_placeholder_metadatum = VT_EMPTY; is this because Clang-Tidy complains about the (deliberate) casting-away of |
No, this was clang itself compiling it. I think clang17, or whatever is in Alpine Linux 3.20.0.
Actually it was gcc complaining about it. So both compiler errors. I'm on holiday for a week and don't have access to my sources right now, but from memory these are my CFLAGS.
I think I included -pedantic and -std=c23 as well, but can't be sure. |
If the
Oh, I see. The issue here is the use of |
Fixes #6.