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
Improve const correctness for P11KitUri #152
Conversation
Thank you. But actually, adding
I suppose these are harmless, but I am not completely sure. @nmav do you happen to have an experience of applying such changes? |
I believe this is a false positive. See here: https://stackoverflow.com/questions/5083765/does-changing-fmystruct-a-to-fconst-mystruct-a-breaks-api-abi-in-c |
I also think that const-addition changes don't affect ABI. abi-compliance-checker may be more explicit about it. |
const char *pin); | ||
|
||
const char* p11_kit_uri_get_pin_source (P11KitUri *uri); | ||
const char* p11_kit_uri_get_pin_source (const P11KitUri *uri); |
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.
Should we add const
to other const char *
getters, such as p11_kit_uri_get_module_name()
and p11_kit_uri_get_module_path()
?
This does not improve const for the getters. The reason for this is that they are usually passed into the PKCS#11 APIs directly and these APIs are not const correct. Trying to force const correctnesss here would result in pain for library consumers. This is an API and ABI compatible change.
@ueno I have added const to the following functions:
I believe this now covers all of the low hanging fruit. |
Thank you! |
This breaks building gnutls 3.6.2 with p11-kit
|
Ouch, indeed this patch also changes the types while adding the const. It seems that the block inside |
Since we now use the non-PTR variants in function definitions, we need to ensure that we properly typedef them if CRYPTOKI_GNU is set. See: p11-glue#152
Since we now use the non-PTR variants in function definitions, we need to ensure that we properly typedef them if CRYPTOKI_GNU is set. See: p11-glue#152
This does not improve const for the getters. The reason for this is that
they are usually passed into the PKCS#11 APIs directly and these APIs
are not const correct. Trying to force const correctnesss here would
result in pain for library consumers.
This is an API and ABI compatible change.