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
Wrong macros in mps_common.h #6254
Comments
Hi! Many thanks for reporting this - could you possibly supply the warnings you are getting, the GCC version and the platform you are targetting? Many thanks, Paul. |
The definitions have correct values. But they can't be used in preprocessor conditionals, since the preprocessor doesn't know about types (whether it's through casts, sizeof or whatever). Either we need to change the preprocessor conditionals or to change the definitions to use |
Hullo. I'm using arm-none-eabi-gcc-10.2.1 and my target is STM32F7. As we can read in the doxygen comment "For now, we use the default type of size_t throughout, and the use of smaller types or different types for ::mbedtls_mps_size_t and ::mbedtls_mps_stored_size_t is not yet supported.", I suggest to use as hinted by Gilles: This would have to be corrected when the support for different size is added, which is probably far in the future. One way to go would be as follow: Best regards, Simon |
Hi! I would invite you to make a PR for this here - that would likely be the quickest resolution here, given its a very small PR. Regards, Paul. |
Actually, this would be a good use-case for a putative |
In mbedtls/library/mps_common.h I have GCC warnings for those:
typedef size_t mbedtls_mps_stored_size_t;
#define MBEDTLS_MPS_STORED_SIZE_MAX ( (mbedtls_mps_stored_size_t) -1 )
typedef size_t mbedtls_mps_size_t;
#define MBEDTLS_MPS_SIZE_MAX ( (mbedtls_mps_size_t) -1 )
It looks like it should be either sizeof(type)-1 or 2^sizeof(type)-1.
Current behavior of GCC is defaulting types values with 0 in the macros.
The text was updated successfully, but these errors were encountered: