mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
backport MBEDTLS_MAYBE_UNUSED
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
@ -350,4 +350,31 @@ static inline const unsigned char *mbedtls_buffer_offset_const(
|
|||||||
#define MBEDTLS_STATIC_ASSERT(expr, msg)
|
#define MBEDTLS_STATIC_ASSERT(expr, msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Suppress compiler warnings for unused functions and variables. */
|
||||||
|
#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__has_attribute)
|
||||||
|
# if __has_attribute(unused)
|
||||||
|
# define MBEDTLS_MAYBE_UNUSED __attribute__((unused))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__GNUC__)
|
||||||
|
# define MBEDTLS_MAYBE_UNUSED __attribute__((unused))
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__IAR_SYSTEMS_ICC__) && defined(__VER__)
|
||||||
|
/* IAR does support __attribute__((unused)), but only if the -e flag (extended language support)
|
||||||
|
* is given; the pragma always works.
|
||||||
|
* Unfortunately the pragma affects the rest of the file where it is used, but this is harmless.
|
||||||
|
* Check for version 5.2 or later - this pragma may be supported by earlier versions, but I wasn't
|
||||||
|
* able to find documentation).
|
||||||
|
*/
|
||||||
|
# if (__VER__ >= 5020000)
|
||||||
|
# define MBEDTLS_MAYBE_UNUSED _Pragma("diag_suppress=Pe177")
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(_MSC_VER)
|
||||||
|
# define MBEDTLS_MAYBE_UNUSED __pragma(warning(suppress:4189))
|
||||||
|
#endif
|
||||||
|
#if !defined(MBEDTLS_MAYBE_UNUSED)
|
||||||
|
# define MBEDTLS_MAYBE_UNUSED
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_LIBRARY_COMMON_H */
|
#endif /* MBEDTLS_LIBRARY_COMMON_H */
|
||||||
|
Reference in New Issue
Block a user