mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 07:24:15 +01:00
Cleaner implementation of MBEDTLS_IGNORE_RETURN
The previous implementation was misparsed in constructs like `if (condition) MBEDTLS_IGNORE_RETURN(...); else ...;`. Implement it as an expression, tested with GCC, Clang and MSVC. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
9110809c46
commit
327cb72e76
@ -205,8 +205,15 @@ MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t;
|
||||
*
|
||||
* Silences warning about unused return value given by functions
|
||||
* with \c MBEDTLS_CHECK_RETURN attribute.
|
||||
/* GCC doesn't silence the warning with just (void)(result).
|
||||
* !(void)(result) is known to work up at least up to GCC 10, as well
|
||||
* as with Clang and MSVC.
|
||||
*
|
||||
* https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Non_002dbugs.html
|
||||
* https://stackoverflow.com/questions/40576003/ignoring-warning-wunused-result
|
||||
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
|
||||
*/
|
||||
#define MBEDTLS_IGNORE_RETURN(result) if( result ) {}
|
||||
#define MBEDTLS_IGNORE_RETURN(result) ( (void) !( result ) )
|
||||
|
||||
/**
|
||||
* \brief Securely zeroize a buffer
|
||||
|
Loading…
Reference in New Issue
Block a user