Skip to content
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

cast discards 'const' qualifier from pointer target type #6

Closed
rsmarples opened this issue May 21, 2024 · 1 comment · May be fixed by #7
Closed

cast discards 'const' qualifier from pointer target type #6

rsmarples opened this issue May 21, 2024 · 1 comment · May be fixed by #7

Comments

@rsmarples
Copy link

../vendor/verstable/verstable.h: In function 'vt_first_nonzero_uint16':
../vendor/verstable/verstable.h:474:8: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
  474 |   if( *(char *)&endian_checker ) // Little-endian (the compiler will optimize away the check at -O1 and above).
      |        ^
../vendor/verstable/verstable.h: In function 'path_access_map_init':
../vendor/verstable/verstable.h:902:21: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
  902 |   table->metadata = (uint16_t *)&vt_empty_placeholder_metadatum;
      |                     ^
../vendor/verstable/verstable.h: In function 'path_access_map_init_clone':
../vendor/verstable/verstable.h:948:23: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
  948 |     table->metadata = (uint16_t *)&vt_empty_placeholder_metadatum;
      |                       ^
../vendor/verstable/verstable.h: In function 'path_access_map_shrink':
../vendor/verstable/verstable.h:1627:23: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
 1627 |     table->metadata = (uint16_t *)&vt_empty_placeholder_metadatum;
      |                       ^
rsmarples added a commit to rsmarples/Verstable that referenced this issue May 21, 2024
@JacksonAllan
Copy link
Owner

I've addressed the discarding of const in the endian-checking function in v2.1.0 because it was an easy fix. Regarding table->metadata = (uint16_t *)&vt_empty_placeholder_metadatum;, I'm going to close this issue in order to centralize discussion about optional compiler diagnostics here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants